mirror of
https://github.com/jpush/jpush-phonegap-plugin.git
synced 2025-02-20 20:22:50 +08:00
commit
23ae6ad342
@ -7,7 +7,7 @@
|
||||
- [设置保留最近通知条数](#设置保留最近通知条数)
|
||||
- [本地通知](#本地通知)
|
||||
- [获取推送连接状态](#获取推送连接状态)
|
||||
|
||||
- [地理围栏](#地理围栏)
|
||||
|
||||
## 获取集成日志(同时适用于 iOS)
|
||||
|
||||
@ -215,4 +215,34 @@ window.JPush.getConnectionState(function (result) {
|
||||
// 断开状态
|
||||
}
|
||||
})
|
||||
```
|
||||
```
|
||||
|
||||
## 地理围栏
|
||||
|
||||
### API - setGeofenceInterval
|
||||
|
||||
设置地理围栏监控周期,最小3分钟,最大1天。默认为15分钟,当距离地理围栏边界小于1000米周期自动调整为3分钟。设置成功后一直使用设置周期,不会进行调整。
|
||||
|
||||
#### 接口定义
|
||||
|
||||
```js
|
||||
window.JPush.setGeofenceInterval(interval)
|
||||
```
|
||||
|
||||
#### 参数说明
|
||||
|
||||
- interval: 监控周期,单位是毫秒。
|
||||
|
||||
### API - setMaxGeofenceNumber
|
||||
|
||||
设置最多允许保存的地理围栏数量,超过最大限制后,如果继续创建先删除最早创建的地理围栏。默认数量为10个,允许设置最小1个,最大100个。
|
||||
|
||||
#### 接口定义
|
||||
|
||||
```js
|
||||
window.JPush.setMaxGeofenceNumber(maxNumber)
|
||||
```
|
||||
|
||||
#### 参数说明
|
||||
|
||||
- maxNumber: 最多允许保存的地理围栏个数
|
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "jpush-phonegap-plugin",
|
||||
"version": "3.6.0",
|
||||
"version": "3.6.1",
|
||||
"description": "JPush for cordova plugin",
|
||||
"cordova": {
|
||||
"id": "jpush-phonegap-plugin",
|
||||
|
@ -2,7 +2,7 @@
|
||||
<plugin xmlns="http://apache.org/cordova/ns/plugins/1.0"
|
||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
id="jpush-phonegap-plugin"
|
||||
version="3.6.0">
|
||||
version="3.6.1">
|
||||
|
||||
<name>JPush</name>
|
||||
<description>JPush for cordova plugin</description>
|
||||
|
@ -627,6 +627,16 @@ public class JPushPlugin extends CordovaPlugin {
|
||||
}
|
||||
}
|
||||
|
||||
void setGeofenceInterval(JSONArray data, CallbackContext callbackContext) throws JSONException {
|
||||
long interval = data.getLong(0);
|
||||
JPushInterface.setGeofenceInterval(this.cordova.getActivity(), interval);
|
||||
}
|
||||
|
||||
void setMaxGeofenceNumber(JSONArray data, CallbackContext callbackContext) throws JSONException {
|
||||
int maxNumber = data.getInt(0);
|
||||
JPushInterface.setMaxGeofenceNumber(mContext, maxNumber);
|
||||
}
|
||||
|
||||
private boolean isValidHour(int hour) {
|
||||
return !(hour < 0 || hour > 23);
|
||||
}
|
||||
@ -706,4 +716,5 @@ public class JPushPlugin extends CordovaPlugin {
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -14,7 +14,7 @@ import cn.jpush.android.api.JPushInterface;
|
||||
public class JPushReceiver extends BroadcastReceiver {
|
||||
|
||||
private static final List<String> IGNORED_EXTRAS_KEYS = Arrays.asList("cn.jpush.android.TITLE",
|
||||
"cn.jpush.android.MESSAGE", "cn.jpush.android.APPKEY", "cn.jpush.android.NOTIFICATION_CONTENT_TITLE");
|
||||
"cn.jpush.android.MESSAGE", "cn.jpush.android.APPKEY", "cn.jpush.android.NOTIFICATION_CONTENT_TITLE","key_show_entity","platform");
|
||||
|
||||
@Override
|
||||
public void onReceive(Context context, Intent intent) {
|
||||
|
@ -463,6 +463,18 @@ JPushPlugin.prototype.setPushTime = function(weekdays, startHour, endHour) {
|
||||
}
|
||||
};
|
||||
|
||||
JPushPlugin.prototype.setGeofenceInterval = function(interval) {
|
||||
if (device.platform === "Android") {
|
||||
this.callNative("setGeofenceInterval", [interval], null);
|
||||
}
|
||||
};
|
||||
|
||||
JPushPlugin.prototype.setMaxGeofenceNumber = function(maxNumber) {
|
||||
if (device.platform === "Android") {
|
||||
this.callNative("setMaxGeofenceNumber", [maxNumber], null);
|
||||
}
|
||||
};
|
||||
|
||||
if (!window.plugins) {
|
||||
window.plugins = {};
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user