diff --git a/README.md b/README.md index 7228889..23e29f2 100644 --- a/README.md +++ b/README.md @@ -2,7 +2,7 @@ [![Build Status](https://travis-ci.org/jpush/jpush-phonegap-plugin.svg?branch=master)](https://travis-ci.org/jpush/jpush-phonegap-plugin) [![QQ Group](https://img.shields.io/badge/QQ%20Group-413602425-red.svg)]() -[![release](https://img.shields.io/badge/release-3.1.7-blue.svg)](https://github.com/jpush/jpush-phonegap-plugin/releases) +[![release](https://img.shields.io/badge/release-3.1.8-blue.svg)](https://github.com/jpush/jpush-phonegap-plugin/releases) [![platforms](https://img.shields.io/badge/platforms-iOS%7CAndroid-lightgrey.svg)](https://github.com/jpush/jpush-phonegap-plugin) [![weibo](https://img.shields.io/badge/weibo-JPush-blue.svg)](http://weibo.com/jpush?refer_flag=1001030101_&is_all=1) @@ -103,7 +103,7 @@ cordova platform update ios ## Support - QQ 群:413602425 - [JPush 官网文档](https://docs.jiguang.cn/jpush/guideline/intro/) - + - [极光社区](http://community.jiguang.cn/) ## Contribute Please contribute! [Look at the issues](https://github.com/jpush/jpush-phonegap-plugin/issues). diff --git a/package.json b/package.json index 6543f19..9de53d8 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "jpush-phonegap-plugin", - "version": "3.1.7", + "version": "3.1.8", "description": "JPush for cordova plugin", "cordova": { "id": "jpush-phonegap-plugin", @@ -21,13 +21,9 @@ "cordova-ios", "cordova-android" ], - "engines": [{ - "name": "cordova", - "version": ">=3.0" - }], - "dependencies": { + "devDependencies": { "cordova-plugin-device": "*", - "cordova-plugin-jcore": "1.1.4" + "cordova-plugin-jcore": "*" }, "author": "JiGuang", "license": "MIT", diff --git a/plugin.xml b/plugin.xml index 0935590..bf10b86 100644 --- a/plugin.xml +++ b/plugin.xml @@ -2,7 +2,7 @@ + version="3.1.8"> JPush JPush for cordova plugin diff --git a/src/android/JPushPlugin.java b/src/android/JPushPlugin.java index 70a309f..0decb2d 100644 --- a/src/android/JPushPlugin.java +++ b/src/android/JPushPlugin.java @@ -458,6 +458,11 @@ public class JPushPlugin extends CordovaPlugin { } } + void getConnectionState(JSONArray data, CallbackContext callback) { + boolean isConnected = JPushInterface.getConnectionState(cordovaActivity.getApplicationContext()); + callback.success(String.valueOf(isConnected)); + } + /** * 自定义通知行为,声音、震动、呼吸灯等。 */ diff --git a/www/JPushPlugin.js b/www/JPushPlugin.js index f374cd9..b639717 100644 --- a/www/JPushPlugin.js +++ b/www/JPushPlugin.js @@ -208,6 +208,12 @@ JPushPlugin.prototype.addNotificationActions = function (actions, categoryId) { } // Android methods +JPushPlugin.prototype.getConnectionState = function (successCallback) { + if (device.platform === 'Android') { + this.callNative('getConnectionState', [], successCallback) + } +} + JPushPlugin.prototype.setBasicPushNotificationBuilder = function () { if (device.platform === 'Android') { this.callNative('setBasicPushNotificationBuilder', [], null)