-
设置主题 setThemeInfo
cordova.plugins.gizGeofencing.setThemeInfo({"themeColor": "FFFFFF", "navi_bg": "FFFFFF", "titleColor": "FFFFFF", "title": "标题", "right_title": "导航栏右侧按钮标题"}, success, error);
-
设置服务器信息 setServerInfo
cordova.plugins.gizGeofencing.setServerInfo({"url": "", "version": "", "token": "", "appKey": "", "type": ""}, success, error);
-
选择或编辑区域 pickRegion
region = {"latitude": 22.123456, "longitude": 113.123456, "radius": 200, "status": "enter/leave", "conditionId": ""};
cordova.plugins.gizGeofencing.pickRegion({}, func (newRegion) {
}, func (errorCode) {
});
cordova.plugins.gizGeofencing.pickRegion(region, func (editedRegion) {
}, func (errorCode) {
});
-
选择地址 pickAddress
address = {"latitude": 22.123456, "longitude": 113.123456};
cordova.plugins.gizGeofencing.pickAddress({}, func (newAddress) {
}, func (errorCode) {
});
cordova.plugins.gizGeofencing.pickAddress(address, func (editedAddress) {
}, func (errorCode) {
});
-
添加区域 addRegion
region = {"latitude": 22.123456, "longitude": 113.123456, "radius": 200, "status": "enter/leave", "conditionId": ""};
cordova.plugins.gizGeofencing.addRegion(region, success, error);
-
移除区域 removeRegion
region = {"latitude": 22.123456, "longitude": 113.123456, "radius": 200, "status": "enter/leave", "conditionId": ""};
cordova.plugins.gizGeofencing.removeRegion(region, success, error);
-
移除所有区域 removeAllRegions
cordova.plugins.gizGeofencing.removeAllRegions(success, error);
-
获取区域列表 getRegionList
cordova.plugins.gizGeofencing.getRegionList(func (regionList) {
}, error);
-
设置区域列表 setRegionList
region = {"latitude": 22.123456, "longitude": 113.123456, "radius": 200, "status": "enter/leave", "conditionId": ""};
regionList = [region];
cordova.plugins.gizGeofencing.setRegionList(regionList, success, error);
-
获取位置功能授权状态 getAuthorizationStatus
cordova.plugins.gizGeofencing.getAuthorizationStatus(func (status) {
}, error);
授权状态值及对应说明:
授权状态值 | 描述 |
---|
0 | 未授权 Authorization status not determined |
1 | 位置功能不可用 Authorization status restricted |
2 | 拒绝授权 Authorization status denied |
3 | 位置功能总是可用 Authorization status authorized always |
4 | 位置功能在App运行时可用 Authorization status authorized when in use |
-
请求总是使用位置信息的权限 requestAlwaysAuthorization
cordova.plugins.gizGeofencing.requestAlwaysAuthorization(func (status) {
}, error);
-
获取当前位置 getCurrentLocation
cordova.plugins.gizGeofencing.getCurrentLocation(func (coordinate) {
}, func (errorCode) {
});
-
解析地址 getAddressInfo
coordinate = {"latitude": 23.123456, "longitude": 123.123456};
cordova.plugins.gizGeofencing.getAddressInfo(coordinate, func (address) {
}, func (errorCode) {
});
// 地址格式
{
"FormattedAddressLines": [
"中国广东省广州市天河区沙东街道沙太路陶庄5号"
],
"Street": "沙太路陶庄5号",
"Thoroughfare": "沙太路陶庄5号",
"Name": "沙东轻工业大厦",
"City": "广州市",
"Country": "中国",
"State": "广东省",
"SubLocality": "天河区",
"CountryCode": "CN"
}