Merge pull request #390 from jpush/dev

Dev
This commit is contained in:
JoshLipan 2018-12-28 17:32:40 +08:00 committed by GitHub
commit 23ae6ad342
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 58 additions and 5 deletions

View File

@ -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: 最多允许保存的地理围栏个数

View File

@ -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",

View File

@ -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>

View File

@ -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;
}
}

View File

@ -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) {

View File

@ -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 = {};
}