添加极光推送插件
diff --git a/platforms/android/android.json b/platforms/android/android.json
index 825de01..6103bb9 100644
--- a/platforms/android/android.json
+++ b/platforms/android/android.json
@@ -51,6 +51,10 @@
{
"xml": "<feature name=\"ThemeableBrowser\"><param name=\"android-package\" value=\"com.initialxy.cordova.themeablebrowser.ThemeableBrowser\" /></feature>",
"count": 1
+ },
+ {
+ "xml": "<feature name=\"JPushPlugin\"><param name=\"android-package\" value=\"cn.jiguang.cordova.push.JPushPlugin\" /></feature>",
+ "count": 1
}
]
}
@@ -82,6 +86,78 @@
"/manifest": [
{
"xml": "<uses-permission android:name=\"android.permission.INTERNET\" />",
+ "count": 2
+ },
+ {
+ "xml": "<permission android:name=\"com.supwisdom.dlapp.permission.JPUSH_MESSAGE\" android:protectionLevel=\"signature\" />",
+ "count": 1
+ },
+ {
+ "xml": "<uses-permission android:name=\"com.supwisdom.dlapp.permission.JPUSH_MESSAGE\" />",
+ "count": 1
+ },
+ {
+ "xml": "<uses-permission android:name=\"android.permission.RECEIVE_USER_PRESENT\" />",
+ "count": 1
+ },
+ {
+ "xml": "<uses-permission android:name=\"android.permission.READ_PHONE_STATE\" />",
+ "count": 1
+ },
+ {
+ "xml": "<uses-permission android:name=\"android.permission.WRITE_EXTERNAL_STORAGE\" />",
+ "count": 1
+ },
+ {
+ "xml": "<uses-permission android:name=\"android.permission.READ_EXTERNAL_STORAGE\" />",
+ "count": 1
+ },
+ {
+ "xml": "<uses-permission android:name=\"android.permission.MOUNT_UNMOUNT_FILESYSTEMS\" />",
+ "count": 1
+ },
+ {
+ "xml": "<uses-permission android:name=\"android.permission.ACCESS_NETWORK_STATE\" />",
+ "count": 1
+ },
+ {
+ "xml": "<uses-permission android:name=\"android.permission.ACCESS_WIFI_STATE\" />",
+ "count": 1
+ },
+ {
+ "xml": "<uses-permission android:name=\"android.permission.VIBRATE\" />",
+ "count": 1
+ },
+ {
+ "xml": "<uses-permission android:name=\"android.permission.SYSTEM_ALERT_WINDOW\" />",
+ "count": 1
+ },
+ {
+ "xml": "<uses-permission android:name=\"android.permission.ACCESS_COARSE_LOCATION\" />",
+ "count": 1
+ },
+ {
+ "xml": "<uses-permission android:name=\"android.permission.CHANGE_WIFI_STATE\" />",
+ "count": 1
+ },
+ {
+ "xml": "<uses-permission android:name=\"android.permission.ACCESS_FINE_LOCATION\" />",
+ "count": 1
+ },
+ {
+ "xml": "<uses-permission android:name=\"android.permission.ACCESS_BACKGROUND_LOCATION\" />",
+ "count": 1
+ },
+ {
+ "xml": "<uses-permission android:name=\"android.permission.ACCESS_LOCATION_EXTRA_COMMANDS\" />",
+ "count": 1
+ },
+ {
+ "xml": "<uses-permission android:name=\"android.permission.CHANGE_NETWORK_STATE\" />",
+ "count": 1
+ },
+ {
+ "xml": "<uses-permission android:name=\"android.permission.GET_TASKS\" />",
"count": 1
}
],
@@ -90,6 +166,64 @@
"xml": "<provider android:authorities=\"${applicationId}.provider\" android:exported=\"false\" android:grantUriPermissions=\"true\" android:name=\"org.apache.cordova.camera.FileProvider\"><meta-data android:name=\"android.support.FILE_PROVIDER_PATHS\" android:resource=\"@xml/camera_provider_paths\" /></provider>",
"count": 1
}
+ ],
+ "/manifest/application": [
+ {
+ "xml": "<activity android:exported=\"false\" android:name=\"cn.jpush.android.ui.PopWinActivity\" android:theme=\"@style/MyDialogStyle\"></activity>",
+ "count": 1
+ },
+ {
+ "xml": "<activity android:configChanges=\"orientation|keyboardHidden\" android:exported=\"false\" android:name=\"cn.jpush.android.ui.PushActivity\" android:theme=\"@android:style/Theme.NoTitleBar\"><intent-filter><action android:name=\"cn.jpush.android.ui.PushActivity\" /><category android:name=\"android.intent.category.DEFAULT\" /><category android:name=\"com.supwisdom.dlapp\" /></intent-filter></activity>",
+ "count": 1
+ },
+ {
+ "xml": "<service android:exported=\"false\" android:name=\"cn.jpush.android.service.PushService\" android:process=\":pushcore\"><intent-filter><action android:name=\"cn.jpush.android.intent.REGISTER\" /><action android:name=\"cn.jpush.android.intent.REPORT\" /><action android:name=\"cn.jpush.android.intent.PushService\" /><action android:name=\"cn.jpush.android.intent.PUSH_TIME\" /></intent-filter></service>",
+ "count": 1
+ },
+ {
+ "xml": "<provider android:authorities=\"com.supwisdom.dlapp.DataProvider\" android:exported=\"false\" android:name=\"cn.jpush.android.service.DataProvider\" android:process=\":pushcore\" />",
+ "count": 1
+ },
+ {
+ "xml": "<service android:enabled=\"true\" android:exported=\"true\" android:name=\"cn.jpush.android.service.DaemonService\"><intent-filter><action android:name=\"cn.jpush.android.intent.DaemonService\" /><category android:name=\"com.supwisdom.dlapp\" /></intent-filter></service>",
+ "count": 1
+ },
+ {
+ "xml": "<provider android:authorities=\"com.supwisdom.dlapp.DownloadProvider\" android:exported=\"true\" android:name=\"cn.jpush.android.service.DownloadProvider\" />",
+ "count": 1
+ },
+ {
+ "xml": "<receiver android:enabled=\"true\" android:exported=\"false\" android:name=\"cn.jpush.android.service.PushReceiver\"><intent-filter android:priority=\"1000\"><action android:name=\"cn.jpush.android.intent.NOTIFICATION_RECEIVED_PROXY\" /><category android:name=\"com.supwisdom.dlapp\" /></intent-filter><intent-filter><action android:name=\"android.intent.action.USER_PRESENT\" /><action android:name=\"android.net.conn.CONNECTIVITY_CHANGE\" /></intent-filter><intent-filter><action android:name=\"android.intent.action.PACKAGE_ADDED\" /><action android:name=\"android.intent.action.PACKAGE_REMOVED\" /><data android:scheme=\"package\" /></intent-filter></receiver>",
+ "count": 1
+ },
+ {
+ "xml": "<receiver android:exported=\"false\" android:name=\"cn.jpush.android.service.AlarmReceiver\" />",
+ "count": 1
+ },
+ {
+ "xml": "<receiver android:name=\"cn.jiguang.cordova.push.JPushEventReceiver\"><intent-filter><action android:name=\"cn.jpush.android.intent.RECEIVE_MESSAGE\" /><category android:name=\"com.supwisdom.dlapp\" /></intent-filter></receiver>",
+ "count": 1
+ },
+ {
+ "xml": "<activity android:exported=\"true\" android:name=\"cn.jpush.android.service.JNotifyActivity\" android:taskAffinity=\"jpush.custom\" android:theme=\"@android:style/Theme.Translucent.NoTitleBar\"><intent-filter><action android:name=\"cn.jpush.android.intent.JNotifyActivity\" /><category android:name=\"com.supwisdom.dlapp\" /></intent-filter></activity>",
+ "count": 1
+ },
+ {
+ "xml": "<service android:name=\"cn.jiguang.cordova.push.PushService\" android:process=\":pushcore\"><intent-filter><action android:name=\"cn.jiguang.user.service.action\" /></intent-filter></service>",
+ "count": 1
+ },
+ {
+ "xml": "<receiver android:enabled=\"true\" android:exported=\"false\" android:name=\"cn.jiguang.cordova.push.JPushReceiver\"><intent-filter><action android:name=\"cn.jpush.android.intent.REGISTRATION\" /><action android:name=\"cn.jpush.android.intent.MESSAGE_RECEIVED\" /><action android:name=\"cn.jpush.android.intent.NOTIFICATION_RECEIVED\" /><action android:name=\"cn.jpush.android.intent.NOTIFICATION_OPENED\" /><action android:name=\"cn.jpush.android.intent.CONNECTION\" /><category android:name=\"com.supwisdom.dlapp\" /></intent-filter></receiver>",
+ "count": 1
+ },
+ {
+ "xml": "<meta-data android:name=\"JPUSH_CHANNEL\" android:value=\"developer-default\" />",
+ "count": 1
+ },
+ {
+ "xml": "<meta-data android:name=\"JPUSH_APPKEY\" android:value=\"your_jpush_appkey\" />",
+ "count": 1
+ }
]
}
},
@@ -147,6 +281,14 @@
},
"cordova-plugin-themeablebrowser": {
"PACKAGE_NAME": "com.supwisdom.dlapp"
+ },
+ "cordova-plugin-jcore": {
+ "PACKAGE_NAME": "com.supwisdom.dlapp"
+ },
+ "jpush-phonegap-plugin": {
+ "APP_KEY": "your_jpush_appkey",
+ "CHANNEL": "developer-default",
+ "PACKAGE_NAME": "com.supwisdom.dlapp"
}
},
"dependent_plugins": {},
@@ -470,6 +612,14 @@
"clobbers": [
"cordova.ThemeableBrowser"
]
+ },
+ {
+ "id": "jpush-phonegap-plugin.JPushPlugin",
+ "file": "plugins/jpush-phonegap-plugin/www/JPushPlugin.js",
+ "pluginId": "jpush-phonegap-plugin",
+ "clobbers": [
+ "JPush"
+ ]
}
],
"plugin_metadata": {
@@ -485,6 +635,8 @@
"cordova-plugin-camera": "4.0.3",
"cordova-plugin-inappbrowser": "3.0.0",
"cordova-plugin-device": "2.0.2",
- "cordova-plugin-themeablebrowser": "0.2.17"
+ "cordova-plugin-themeablebrowser": "0.2.17",
+ "cordova-plugin-jcore": "1.3.0",
+ "jpush-phonegap-plugin": "3.7.2"
}
}
diff --git a/platforms/android/app/libs/jcore-android-2.1.2.jar b/platforms/android/app/libs/jcore-android-2.1.2.jar
new file mode 100755
index 0000000..9a770dc
--- /dev/null
+++ b/platforms/android/app/libs/jcore-android-2.1.2.jar
Binary files differ
diff --git a/platforms/android/app/libs/jpush-android-3.3.4.jar b/platforms/android/app/libs/jpush-android-3.3.4.jar
new file mode 100755
index 0000000..fef22f8
--- /dev/null
+++ b/platforms/android/app/libs/jpush-android-3.3.4.jar
Binary files differ
diff --git a/platforms/android/app/src/main/AndroidManifest.xml b/platforms/android/app/src/main/AndroidManifest.xml
index f8296a8..0bc45cf 100644
--- a/platforms/android/app/src/main/AndroidManifest.xml
+++ b/platforms/android/app/src/main/AndroidManifest.xml
@@ -1,7 +1,6 @@
<?xml version='1.0' encoding='utf-8'?>
<manifest android:hardwareAccelerated="true" android:versionCode="10000" android:versionName="1.0.0" package="com.supwisdom.dlapp" xmlns:android="http://schemas.android.com/apk/res/android">
<supports-screens android:anyDensity="true" android:largeScreens="true" android:normalScreens="true" android:resizeable="true" android:smallScreens="true" android:xlargeScreens="true" />
- <uses-permission android:name="android.permission.INTERNET" />
<application android:hardwareAccelerated="true" android:icon="@mipmap/ic_launcher" android:label="@string/launcher_name" android:supportsRtl="true">
<activity android:configChanges="orientation|keyboardHidden|keyboard|screenSize|locale" android:label="@string/activity_name" android:launchMode="singleTop" android:name="MainActivity" android:screenOrientation="portrait" android:theme="@android:style/Theme.DeviceDefault.NoActionBar" android:windowSoftInputMode="adjustResize">
<intent-filter android:label="@string/launcher_name">
@@ -12,6 +11,75 @@
<provider android:authorities="${applicationId}.provider" android:exported="false" android:grantUriPermissions="true" android:name="org.apache.cordova.camera.FileProvider">
<meta-data android:name="android.support.FILE_PROVIDER_PATHS" android:resource="@xml/camera_provider_paths" />
</provider>
+ <activity android:exported="false" android:name="cn.jpush.android.ui.PopWinActivity" android:theme="@style/MyDialogStyle" />
+ <activity android:configChanges="orientation|keyboardHidden" android:exported="false" android:name="cn.jpush.android.ui.PushActivity" android:theme="@android:style/Theme.NoTitleBar">
+ <intent-filter>
+ <action android:name="cn.jpush.android.ui.PushActivity" />
+ <category android:name="android.intent.category.DEFAULT" />
+ <category android:name="com.supwisdom.dlapp" />
+ </intent-filter>
+ </activity>
+ <service android:exported="false" android:name="cn.jpush.android.service.PushService" android:process=":pushcore">
+ <intent-filter>
+ <action android:name="cn.jpush.android.intent.REGISTER" />
+ <action android:name="cn.jpush.android.intent.REPORT" />
+ <action android:name="cn.jpush.android.intent.PushService" />
+ <action android:name="cn.jpush.android.intent.PUSH_TIME" />
+ </intent-filter>
+ </service>
+ <provider android:authorities="com.supwisdom.dlapp.DataProvider" android:exported="false" android:name="cn.jpush.android.service.DataProvider" android:process=":pushcore" />
+ <service android:enabled="true" android:exported="true" android:name="cn.jpush.android.service.DaemonService">
+ <intent-filter>
+ <action android:name="cn.jpush.android.intent.DaemonService" />
+ <category android:name="com.supwisdom.dlapp" />
+ </intent-filter>
+ </service>
+ <provider android:authorities="com.supwisdom.dlapp.DownloadProvider" android:exported="true" android:name="cn.jpush.android.service.DownloadProvider" />
+ <receiver android:enabled="true" android:exported="false" android:name="cn.jpush.android.service.PushReceiver">
+ <intent-filter android:priority="1000">
+ <action android:name="cn.jpush.android.intent.NOTIFICATION_RECEIVED_PROXY" />
+ <category android:name="com.supwisdom.dlapp" />
+ </intent-filter>
+ <intent-filter>
+ <action android:name="android.intent.action.USER_PRESENT" />
+ <action android:name="android.net.conn.CONNECTIVITY_CHANGE" />
+ </intent-filter>
+ <intent-filter>
+ <action android:name="android.intent.action.PACKAGE_ADDED" />
+ <action android:name="android.intent.action.PACKAGE_REMOVED" />
+ <data android:scheme="package" />
+ </intent-filter>
+ </receiver>
+ <receiver android:exported="false" android:name="cn.jpush.android.service.AlarmReceiver" />
+ <receiver android:name="cn.jiguang.cordova.push.JPushEventReceiver">
+ <intent-filter>
+ <action android:name="cn.jpush.android.intent.RECEIVE_MESSAGE" />
+ <category android:name="com.supwisdom.dlapp" />
+ </intent-filter>
+ </receiver>
+ <activity android:exported="true" android:name="cn.jpush.android.service.JNotifyActivity" android:taskAffinity="jpush.custom" android:theme="@android:style/Theme.Translucent.NoTitleBar">
+ <intent-filter>
+ <action android:name="cn.jpush.android.intent.JNotifyActivity" />
+ <category android:name="com.supwisdom.dlapp" />
+ </intent-filter>
+ </activity>
+ <service android:name="cn.jiguang.cordova.push.PushService" android:process=":pushcore">
+ <intent-filter>
+ <action android:name="cn.jiguang.user.service.action" />
+ </intent-filter>
+ </service>
+ <receiver android:enabled="true" android:exported="false" android:name="cn.jiguang.cordova.push.JPushReceiver">
+ <intent-filter>
+ <action android:name="cn.jpush.android.intent.REGISTRATION" />
+ <action android:name="cn.jpush.android.intent.MESSAGE_RECEIVED" />
+ <action android:name="cn.jpush.android.intent.NOTIFICATION_RECEIVED" />
+ <action android:name="cn.jpush.android.intent.NOTIFICATION_OPENED" />
+ <action android:name="cn.jpush.android.intent.CONNECTION" />
+ <category android:name="com.supwisdom.dlapp" />
+ </intent-filter>
+ </receiver>
+ <meta-data android:name="JPUSH_CHANNEL" android:value="developer-default" />
+ <meta-data android:name="JPUSH_APPKEY" android:value="your_jpush_appkey" />
</application>
<uses-sdk android:minSdkVersion="19" android:targetSdkVersion="28" />
<uses-permission android:name="android.permission.USE_FINGERPRINT" />
@@ -19,4 +87,22 @@
<uses-permission android:name="android.permission.CAMERA" android:required="false" />
<uses-feature android:name="android.hardware.camera" android:required="false" />
<uses-feature android:name="android.hardware.camera.front" android:required="false" />
+ <uses-permission android:name="android.permission.INTERNET" />
+ <permission android:name="com.supwisdom.dlapp.permission.JPUSH_MESSAGE" android:protectionLevel="signature" />
+ <uses-permission android:name="com.supwisdom.dlapp.permission.JPUSH_MESSAGE" />
+ <uses-permission android:name="android.permission.RECEIVE_USER_PRESENT" />
+ <uses-permission android:name="android.permission.READ_PHONE_STATE" />
+ <uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
+ <uses-permission android:name="android.permission.MOUNT_UNMOUNT_FILESYSTEMS" />
+ <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
+ <uses-permission android:name="android.permission.ACCESS_WIFI_STATE" />
+ <uses-permission android:name="android.permission.VIBRATE" />
+ <uses-permission android:name="android.permission.SYSTEM_ALERT_WINDOW" />
+ <uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
+ <uses-permission android:name="android.permission.CHANGE_WIFI_STATE" />
+ <uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
+ <uses-permission android:name="android.permission.ACCESS_BACKGROUND_LOCATION" />
+ <uses-permission android:name="android.permission.ACCESS_LOCATION_EXTRA_COMMANDS" />
+ <uses-permission android:name="android.permission.CHANGE_NETWORK_STATE" />
+ <uses-permission android:name="android.permission.GET_TASKS" />
</manifest>
diff --git a/platforms/android/app/src/main/assets/www/bindcard.html b/platforms/android/app/src/main/assets/www/bindcard.html
index 3ec9d26..8d2ee2f 100644
--- a/platforms/android/app/src/main/assets/www/bindcard.html
+++ b/platforms/android/app/src/main/assets/www/bindcard.html
@@ -30,34 +30,24 @@
</div>
</div>
<div class="weui-cell" style="padding:0 10px; ">
+ <div class="weui-cell__hd"><label class="weui-label" style="width: 80px;font-size: 14px;">证件类型</label></div>
+ <div class="weui-cell__bd">
+ <input class="weui-input" type="text" id='idtype' placeholder="请选择证件类型" style="font-size: 14px;" />
+ </div>
+ </div>
+ <div class="weui-cell" style="padding:0 10px; ">
+ <div class="weui-cell__hd"><label class="weui-label" style="width: 80px;font-size: 14px;">证件号</label></div>
+ <div class="weui-cell__bd">
+ <input class="weui-input" type="text" id="idno" style="font-size: 14px;" placeholder="请输入您的证件号" >
+ </div>
+ </div>
+ <div class="weui-cell" style="padding:0 10px; ">
<div class="weui-cell__hd"><label class="weui-label" style="width: 80px;font-size: 14px;">银行卡号</label></div>
<div class="weui-cell__bd">
<input class="weui-input" type="text" id="cardnum" style="font-size: 14px;" placeholder="市民卡对应的银行卡号">
</div>
</div>
</div>
-
- <div class="weui-cells__title">短信验证市民卡预留的手机号</div>
- <div class="weui-cells weui-cells_form">
- <div class="weui-cell" style="padding:0 10px; ">
- <div class="weui-cell__hd"><label class="weui-label" style="width: 80px;font-size: 14px;">手机号</label></div>
- <div class="weui-cell__bd">
- <input class="weui-input" type="tel" id="phone" style="font-size: 14px;" placeholder="请输入市民卡预留的手机号" disabled="disabled" >
- </div>
- </div>
- <div class="weui-cell weui-cell_vcode" style="padding:0 10px; ">
- <div class="weui-cell__hd">
- <label class="weui-label" style="width: 80px;font-size: 14px;">验证码</label>
- </div>
- <div class="weui-cell__bd">
- <input class="weui-input" type="number" id="code" style="font-size: 14px;" placeholder="请输入验证码" maxlength="6">
- </div>
- <div class="weui-cell__ft">
- <button class="weui-vcode-btn" onclick="app.getCode()" id="codebtn" style="width: 100px;height: 1rem;font-size: 14px;">获取验证码</button>
- </div>
- </div>
- </div>
-
<section class="aui-content-padded" style="margin-top: 30px;">
<div class="aui-btn aui-btn-block aui-btn-info" tapmode onclick="app.doNext()">下一步</div>
</section>
diff --git a/platforms/android/app/src/main/assets/www/cordova_plugins.js b/platforms/android/app/src/main/assets/www/cordova_plugins.js
index 049ccd6..595ecb1 100644
--- a/platforms/android/app/src/main/assets/www/cordova_plugins.js
+++ b/platforms/android/app/src/main/assets/www/cordova_plugins.js
@@ -319,6 +319,14 @@
"clobbers": [
"cordova.ThemeableBrowser"
]
+ },
+ {
+ "id": "jpush-phonegap-plugin.JPushPlugin",
+ "file": "plugins/jpush-phonegap-plugin/www/JPushPlugin.js",
+ "pluginId": "jpush-phonegap-plugin",
+ "clobbers": [
+ "JPush"
+ ]
}
];
module.exports.metadata = {
@@ -334,6 +342,8 @@
"cordova-plugin-camera": "4.0.3",
"cordova-plugin-inappbrowser": "3.0.0",
"cordova-plugin-device": "2.0.2",
- "cordova-plugin-themeablebrowser": "0.2.17"
+ "cordova-plugin-themeablebrowser": "0.2.17",
+ "cordova-plugin-jcore": "1.3.0",
+ "jpush-phonegap-plugin": "3.7.2"
};
});
\ No newline at end of file
diff --git a/platforms/android/app/src/main/assets/www/js/bill.js b/platforms/android/app/src/main/assets/www/js/bill.js
index c0af3fd..8921bd6 100644
--- a/platforms/android/app/src/main/assets/www/js/bill.js
+++ b/platforms/android/app/src/main/assets/www/js/bill.js
@@ -20,6 +20,7 @@
V1Bills(param,function(ok,ret){
if(ok){
if(ret.code==200){
+ $.hideLoading();
if(ret.page&&ret.page.count>0){
app.initBillView(ret.page)
}else{
diff --git a/platforms/android/app/src/main/assets/www/js/bindcard.js b/platforms/android/app/src/main/assets/www/js/bindcard.js
index 649098d..e9cb86c 100644
--- a/platforms/android/app/src/main/assets/www/js/bindcard.js
+++ b/platforms/android/app/src/main/assets/www/js/bindcard.js
@@ -1,25 +1,58 @@
+var dict;
var app = {
// Application Constructor
initialize: function() {
document.addEventListener('deviceready', this.onDeviceReady.bind(this), false);
},
-
+
onDeviceReady: function() {
var uid = window.localStorage.getItem("uid");
- var phone = window.localStorage.getItem("phoneX");
- if(!isEmpty(phone)){
- $("#phone").val(phone)
- }else{
- phone = window.localStorage.getItem("phone");
- $("#phone").val(phone)
- }
+ this.loadData();
+ },
+ loadData: function() {
+ $.showLoading("正在加载");
+ V1Idtypes(function(ok, ret) {
+ if (ok) {
+ $.hideLoading();
+ if (ret.code == 200) {
+ dict = ret.idtypes;
+ let keys = Object.keys(dict);
+ let vals = Object.values(dict);
+ console.log(keys, vals)
+ var items=[];
+ for(var key of keys){
+ var bean = {
+ "title":dict[key],
+ "value":key
+ }
+ items.push(bean)
+ }
+ $("#idtype").val(items[0].title)
+ $("#idtype").attr("data-values",items[0].value)
+ $("#idtype").select({
+ title: "请选择证件类型",
+ items: items
+ });
+ } else {
+ $.alert(ret.msg, "错误");
+ }
+ } else {
+ $.hideLoading();
+ $.alert("请求失败了 " + ret.status + ",请稍后再试", "错误");
+ }
+ })
},
doNext: function() {
- var code = $("#code").val();
- var cardnum = $("#cardnum").val();
- var name = $("#name").val();
- if(isEmpty(name)||isEmpty(code)||isEmpty(cardnum)){
+ var cardnum = $("#cardnum").val();
+ var name = $("#name").val();
+ var idno = $("#idno").val();
+ if (isEmpty(name) || isEmpty(cardnum)||isEmpty(idno)) {
+ return;
+ }
+ var idtype = $("#idtype").attr("data-values")
+ if(isEmpty(idtype)){
+ $.alert("请选择证件类型", "错误");
return;
}
/*var agree = $("input[type=checkbox]:checked").val();
@@ -28,62 +61,37 @@
return;
}*/
$.showLoading("正在处理");
- var param={
- "cardno":cardnum,
- "code":code,
- "name":name
+ var param = {
+ "cardno": cardnum,
+ "idtype": idtype,
+ "name": name,
+ "idno": idno
}
- V1Bindcard(param,function(ok,ret){
- if(ok){
+ V1Bindcard(param, function(ok, ret) {
+ if (ok) {
$.hideLoading();
console.log(ret)
- if(ret.code==200){
- window.localStorage.setItem("paypwdtype","new");
- window.localStorage.setItem("userid",ret.userid);
- window.localStorage.setItem("signed",ret.signed);
- window.localStorage.setItem("name",name);
- window.localStorage.setItem("paypwdset",ret.paypwdset);
- if(ret.paypwdset){
- if(!isEmpty(ret.signed)&&signed=='yes'){
- window.location='main.html'
- }else{
- window.location='signxy.html'
- }
- }else{
- window.location="paypwdset.html";
- }
- }else{
- if(ret.code==-1){
- $.alert(ret.msg, "提示",function(){
- window.location="main.html"
+ if (ret.code == 200) {
+ window.localStorage.setItem("phoneX",ret.phonex);
+ window.localStorage.setItem("name", name);
+ window.localStorage.setItem("personid", ret.personid);
+ window.localStorage.setItem("signed", ret.signed);
+ window.localStorage.setItem("paypwdset", ret.paypwdset);
+ window.location = "bindcheck.html";
+ } else {
+ if (ret.code == -1) {
+ $.alert(ret.msg, "提示", function() {
+ window.location = "main.html"
});
- }else{
- $.alert(ret.msg, "错误");
+ } else {
+ $.alert(ret.msg, "错误");
}
- }
- }else{
+ }
+ } else {
$.hideLoading();
- $.alert("请求失败了 "+ret.status+",请稍后再试", "错误");
- }
- })
- },
- getCode :function(){
- $.showLoading("请求中");
- V1Code(function(ok,ret){
- if(ok){
- $.hideLoading();
- if(ret.code==200){
- $("#codebtn").attr("disabled","disabled")
- $("#codebtn").addClass("vcodedisabled")
- btnTime('codebtn');
- }else{
- $.alert(ret.msg, "错误");
- }
- }else{
- $.hideLoading();
- $.alert("请求失败了"+ret.status+",请稍后再试", "错误");
+ $.alert("请求失败了 " + ret.status + ",请稍后再试", "错误");
}
})
}
};
-app.initialize();
+app.initialize();
\ No newline at end of file
diff --git a/platforms/android/app/src/main/assets/www/js/index.js b/platforms/android/app/src/main/assets/www/js/index.js
index ba4ea86..112a927 100644
--- a/platforms/android/app/src/main/assets/www/js/index.js
+++ b/platforms/android/app/src/main/assets/www/js/index.js
@@ -41,9 +41,10 @@
if(ret.now-t>1000*60*10){
window.location = "login.html";
}else{
-
window.location = "main.html";
}
+ }else{
+ window.location = "login.html";
}
} else {
//alert('无法请求到服务器,请检查网络并稍后再试');
diff --git a/platforms/android/app/src/main/assets/www/js/login.js b/platforms/android/app/src/main/assets/www/js/login.js
index ab55032..77b8b2a 100644
--- a/platforms/android/app/src/main/assets/www/js/login.js
+++ b/platforms/android/app/src/main/assets/www/js/login.js
@@ -23,7 +23,6 @@
window.location = "findpwd.html";
},
login: function(){
- window.location = "main.html";
//loading("正在处理");
var phone = $("#phone").val()
var pwd = $("#pwd").val()
diff --git a/platforms/android/app/src/main/assets/www/js/qrcode.js b/platforms/android/app/src/main/assets/www/js/qrcode.js
index 35fe7a3..4664a9b 100644
--- a/platforms/android/app/src/main/assets/www/js/qrcode.js
+++ b/platforms/android/app/src/main/assets/www/js/qrcode.js
@@ -7,17 +7,58 @@
onDeviceReady: function() {
var uid = window.localStorage.getItem("token");
- var qrcode = new QRCode(document.getElementById("qrcode"), {
- text: uid,
- width: 150,
- height: 150,
- colorDark : "#000000",
- colorLight : "#ffffff",
- correctLevel : QRCode.CorrectLevel.L
- });
+ this.loadQrcode();
+ setInterval(function () {
+ window.location.reload();
+ },100000);
},
- toBillDetail :function(refno){
-
+ loadQrcode: function() {
+ $.showLoading("加载中");
+ V1Qrcode(function(ok, ret) {
+ if (ok) {
+ console.log(ret)
+ if (ret.code == 200) {
+ $.hideLoading();
+ var qrcode = new QRCode(document.getElementById("qrcode"), {
+ text: ret.qrcode,
+ width: 150,
+ height: 150,
+ colorDark: "#000000",
+ colorLight: "#ffffff",
+ correctLevel: QRCode.CorrectLevel.L
+ });
+ } else {
+ $.hideLoading();
+ $.alert("请求失败,请稍后再试", "错误");
+ }
+ } else {
+ $.hideLoading();
+ $.alert("请求失败了:" + ret.status + "请稍后再试", "错误");
+ }
+ })
+ },
+ refresh:function(){
+ V1Qrcode(function(ok, ret) {
+ if (ok) {
+ if (ret.code == 200) {
+ $.hideLoading();
+ var qrcode = new QRCode(document.getElementById("qrcode"), {
+ text: ret.qrcode,
+ width: 150,
+ height: 150,
+ colorDark: "#000000",
+ colorLight: "#ffffff",
+ correctLevel: QRCode.CorrectLevel.L
+ });
+ } else {
+ $.hideLoading();
+ $.alert("请求失败,请稍后再试", "错误");
+ }
+ } else {
+ $.hideLoading();
+ $.alert("请求失败了:" + ret.status + "请稍后再试", "错误");
+ }
+ })
}
};
app.initialize();
\ No newline at end of file
diff --git a/platforms/android/app/src/main/assets/www/js/security.js b/platforms/android/app/src/main/assets/www/js/security.js
index 3586930..f12a1cc 100644
--- a/platforms/android/app/src/main/assets/www/js/security.js
+++ b/platforms/android/app/src/main/assets/www/js/security.js
@@ -4,11 +4,7 @@
initialize: function() {
document.addEventListener('deviceready', this.onDeviceReady.bind(this), false);
},
-
onDeviceReady: function() {
- var uid = window.localStorage.getItem("uid");
- var phone = window.localStorage.getItem("phoneX");
-
},
editPwd: function() {
window.location = "editpwd.html";
@@ -19,6 +15,13 @@
logout:function(){
window.localStorage.removeItem("token");
window.location = "login.html";
+ },
+ loginByTouchId: function() {
+ Fingerprint.isAvailable(function(result){
+ alert("Fingerprint available");
+ }, function(message){
+ alert(message);
+ });
}
};
app.initialize();
diff --git a/platforms/android/app/src/main/assets/www/js/server.js b/platforms/android/app/src/main/assets/www/js/server.js
index 3194de9..2bd6a73 100644
--- a/platforms/android/app/src/main/assets/www/js/server.js
+++ b/platforms/android/app/src/main/assets/www/js/server.js
@@ -1,11 +1,17 @@
var dev = true;
-var SERVER = "";
+var SERVER = "http://ykt.supwisdom.com:10010/payapi/mobileapi";
var GLOBAL_TODAY="";
var GLOBAL_YESTERDAY="";
var CURRENT_INDEX=1;
if (dev) {
SERVER = "http://172.28.43.3:8099/payapi/mobileapi";
}
+function V1Qrcode(callback) {
+ ajaxPost("/v1/qrcode", {}, callback)
+}
+function V1Idtypes(callback) {
+ ajaxPost("/v1/idtypes", {}, callback)
+}
function V1Cardinfor(callback) {
ajaxPost("/v1/cardinfor", {}, callback)
}
diff --git a/platforms/android/app/src/main/assets/www/qrcode.html b/platforms/android/app/src/main/assets/www/qrcode.html
index 3391537..ca6cb07 100644
--- a/platforms/android/app/src/main/assets/www/qrcode.html
+++ b/platforms/android/app/src/main/assets/www/qrcode.html
@@ -23,10 +23,10 @@
<div style="display: flex;flex-direction: row;justify-content: center;align-items: center;margin-top: 50px;">
<div style="background: #fff;text-align: center;" id="qrcode"></div>
</div>
- <p style="text-align: center;margin-top:20px;color:#999">请将二维码对准扫描设备</p>
- <div style="padding: 30px;">
- <div class="aui-btn aui-btn-block aui-btn-info" tapmode onclick="app.refresh()">手动刷新二维码</div>
- </div>
+ <p style="text-align: center;margin-top:40px;color:#999">请将二维码对准扫描设备</p>
+ <!--<div style="padding: 30px;">
+ <div class="aui-btn aui-btn-block aui-btn-info" tapmode onclick="window.location.reload();">刷新二维码</div>
+ </div>-->
</body>
</html>
<script type="text/javascript" src="cordova.js"></script>
diff --git a/platforms/android/app/src/main/assets/www/security.html b/platforms/android/app/src/main/assets/www/security.html
index 6994b22..049a988 100644
--- a/platforms/android/app/src/main/assets/www/security.html
+++ b/platforms/android/app/src/main/assets/www/security.html
@@ -31,6 +31,15 @@
<div class="aui-list-item-right"></div>
</div>
</li>
+ <!--<li class="aui-list-item" onclick="app.loginByTouchId()">
+ <div class="aui-list-item-label-icon">
+ <i class="aui-iconfont aui-icon-lock aui-text-info"></i>
+ </div>
+ <div class="aui-list-item-inner ">
+ <div class="aui-list-item-title">指纹\人脸登录</div>
+ <div class="aui-list-item-right"><input type="checkbox" id="login" class="aui-switch" ></div>
+ </div>
+ </li>-->
<li class="aui-list-item" onclick="app.toPayPwd()">
<div class="aui-list-item-label-icon">
<i class="aui-iconfont aui-icon-pencil aui-text-danger"></i>
diff --git a/platforms/android/app/src/main/java/cn/jiguang/cordova/push/JPushEventReceiver.java b/platforms/android/app/src/main/java/cn/jiguang/cordova/push/JPushEventReceiver.java
new file mode 100644
index 0000000..17184d9
--- /dev/null
+++ b/platforms/android/app/src/main/java/cn/jiguang/cordova/push/JPushEventReceiver.java
@@ -0,0 +1,202 @@
+package cn.jiguang.cordova.push;
+
+import android.content.Context;
+import android.content.Intent;
+import android.text.TextUtils;
+import android.util.Log;
+
+import org.apache.cordova.CallbackContext;
+import org.json.JSONArray;
+import org.json.JSONException;
+import org.json.JSONObject;
+
+import java.util.Map;
+import java.util.Set;
+
+import cn.jpush.android.api.CustomMessage;
+import cn.jpush.android.api.JPushInterface;
+import cn.jpush.android.api.JPushMessage;
+import cn.jpush.android.api.NotificationMessage;
+import cn.jpush.android.service.JPushMessageReceiver;
+
+public class JPushEventReceiver extends JPushMessageReceiver {
+
+ private static final String TAG = JPushEventReceiver.class.getSimpleName();
+
+ @Override
+ public void onTagOperatorResult(Context context, JPushMessage jPushMessage) {
+ super.onTagOperatorResult(context, jPushMessage);
+ //Log.e(TAG,"onTagOperatorResult:"+jPushMessage);
+ JSONObject resultJson = new JSONObject();
+
+ int sequence = jPushMessage.getSequence();
+ try {
+ resultJson.put("sequence", sequence);
+ } catch (JSONException e) {
+ e.printStackTrace();
+ }
+
+ CallbackContext callback = JPushPlugin.eventCallbackMap.get(sequence);
+
+ if (callback == null) {
+ Log.i(TAG, "Unexpected error, callback is null!");
+ return;
+ }
+
+ if (jPushMessage.getErrorCode() == 0) { // success
+ Set<String> tags = jPushMessage.getTags();
+ JSONArray tagsJsonArr = new JSONArray();
+ for (String tag : tags) {
+ tagsJsonArr.put(tag);
+ }
+
+ try {
+ if (tagsJsonArr.length() != 0) {
+ resultJson.put("tags", tagsJsonArr);
+ }
+ } catch (JSONException e) {
+ e.printStackTrace();
+ }
+
+ callback.success(resultJson);
+
+ } else {
+ try {
+ resultJson.put("code", jPushMessage.getErrorCode());
+ } catch (JSONException e) {
+ e.printStackTrace();
+ }
+
+ callback.error(resultJson);
+ }
+
+ JPushPlugin.eventCallbackMap.remove(sequence);
+ }
+
+ @Override
+ public void onCheckTagOperatorResult(Context context, JPushMessage jPushMessage) {
+ super.onCheckTagOperatorResult(context, jPushMessage);
+
+ //Log.e(TAG,"onCheckTagOperatorResult:"+jPushMessage);
+ JSONObject resultJson = new JSONObject();
+
+ int sequence = jPushMessage.getSequence();
+ try {
+ resultJson.put("sequence", sequence);
+ } catch (JSONException e) {
+ e.printStackTrace();
+ }
+
+ CallbackContext callback = JPushPlugin.eventCallbackMap.get(sequence);
+
+ if (callback == null) {
+ Log.i(TAG, "Unexpected error, callback is null!");
+ return;
+ }
+
+ if (jPushMessage.getErrorCode() == 0) {
+ try {
+ resultJson.put("tag", jPushMessage.getCheckTag());
+ resultJson.put("isBind", jPushMessage.getTagCheckStateResult());
+ } catch (JSONException e) {
+ e.printStackTrace();
+ }
+ callback.success(resultJson);
+
+ } else {
+ try {
+ resultJson.put("code", jPushMessage.getErrorCode());
+ } catch (JSONException e) {
+ e.printStackTrace();
+ }
+ callback.error(resultJson);
+ }
+
+ JPushPlugin.eventCallbackMap.remove(sequence);
+ }
+
+ @Override
+ public void onAliasOperatorResult(Context context, JPushMessage jPushMessage) {
+ super.onAliasOperatorResult(context, jPushMessage);
+
+ //Log.e(TAG,"onAliasOperatorResult:"+jPushMessage);
+ JSONObject resultJson = new JSONObject();
+
+ int sequence = jPushMessage.getSequence();
+ try {
+ resultJson.put("sequence", sequence);
+ } catch (JSONException e) {
+ e.printStackTrace();
+ }
+
+ CallbackContext callback = JPushPlugin.eventCallbackMap.get(sequence);
+
+ if (callback == null) {
+ Log.i(TAG, "Unexpected error, callback is null!");
+ return;
+ }
+
+ if (jPushMessage.getErrorCode() == 0) { // success
+ try {
+ if (!TextUtils.isEmpty(jPushMessage.getAlias())) {
+ resultJson.put("alias", jPushMessage.getAlias());
+ }
+ } catch (JSONException e) {
+ e.printStackTrace();
+ }
+
+ callback.success(resultJson);
+
+ } else {
+ try {
+ resultJson.put("code", jPushMessage.getErrorCode());
+ } catch (JSONException e) {
+ e.printStackTrace();
+ }
+
+ callback.error(resultJson);
+ }
+
+ JPushPlugin.eventCallbackMap.remove(sequence);
+ }
+
+ @Override
+ public void onRegister(Context context, String regId) {
+ //Log.e(TAG,"onRegister:"+regId);
+ JPushPlugin.transmitReceiveRegistrationId(regId);
+ }
+
+ @Override
+ public void onMessage(Context context, CustomMessage customMessage) {
+ super.onMessage(context,customMessage);
+ //Log.e(TAG,"onMessage:"+customMessage);
+// String msg = customMessage.message;//intent.getStringExtra(JPushInterface.EXTRA_MESSAGE);
+// Map<String, Object> extras = getNotificationExtras(intent);
+// JPushPlugin.transmitMessageReceive(msg, extras);
+ }
+
+ @Override
+ public void onNotifyMessageArrived(Context context, NotificationMessage notificationMessage) {
+ super.onNotifyMessageArrived(context, notificationMessage);
+
+ //Log.e(TAG,"onNotifyMessageArrived:"+notificationMessage);
+ }
+
+ @Override
+ public void onNotifyMessageOpened(Context context, NotificationMessage notificationMessage) {
+ super.onNotifyMessageOpened(context, notificationMessage);
+ //Log.e(TAG,"onNotifyMessageOpened:"+notificationMessage);
+ }
+
+ @Override
+ public void onMobileNumberOperatorResult(Context context, JPushMessage jPushMessage) {
+ super.onMobileNumberOperatorResult(context, jPushMessage);
+ //Log.e(TAG,"onMobileNumberOperatorResult:"+jPushMessage);
+ }
+
+ @Override
+ public void onMultiActionClicked(Context context, Intent intent) {
+ super.onMultiActionClicked(context, intent);
+ //Log.e(TAG,"onMultiActionClicked:"+intent);
+ }
+}
diff --git a/platforms/android/app/src/main/java/cn/jiguang/cordova/push/JPushPlugin.java b/platforms/android/app/src/main/java/cn/jiguang/cordova/push/JPushPlugin.java
new file mode 100644
index 0000000..867d511
--- /dev/null
+++ b/platforms/android/app/src/main/java/cn/jiguang/cordova/push/JPushPlugin.java
@@ -0,0 +1,720 @@
+package cn.jiguang.cordova.push;
+
+import android.app.Activity;
+import android.app.AppOpsManager;
+import android.app.NotificationManager;
+import android.content.Context;
+import android.content.pm.ApplicationInfo;
+import android.os.Build;
+import android.text.TextUtils;
+import android.util.Log;
+
+import org.apache.cordova.CallbackContext;
+import org.apache.cordova.CordovaInterface;
+import org.apache.cordova.CordovaPlugin;
+import org.apache.cordova.CordovaWebView;
+import org.json.JSONArray;
+import org.json.JSONException;
+import org.json.JSONObject;
+
+import java.lang.reflect.Field;
+import java.lang.reflect.InvocationTargetException;
+import java.lang.reflect.Method;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.Iterator;
+import java.util.Map;
+import java.util.Map.Entry;
+import java.util.Set;
+
+import cn.jpush.android.api.BasicPushNotificationBuilder;
+import cn.jpush.android.api.JPushInterface;
+import cn.jpush.android.api.TagAliasCallback;
+import cn.jpush.android.data.JPushLocalNotification;
+
+public class JPushPlugin extends CordovaPlugin {
+
+ private static final String TAG = JPushPlugin.class.getSimpleName();
+
+ private Context mContext;
+
+ private static JPushPlugin instance;
+ private static Activity cordovaActivity;
+
+ static String notificationTitle;
+ static String notificationAlert;
+ static Map<String, Object> notificationExtras = new HashMap<String, Object>();
+
+ static String openNotificationTitle;
+ static String openNotificationAlert;
+ static Map<String, Object> openNotificationExtras = new HashMap<String, Object>();
+
+ static Map<Integer, CallbackContext> eventCallbackMap = new HashMap<Integer, CallbackContext>();
+
+ public JPushPlugin() {
+ instance = this;
+ }
+
+ @Override
+ public void initialize(CordovaInterface cordova, CordovaWebView webView) {
+ super.initialize(cordova, webView);
+ mContext = cordova.getActivity().getApplicationContext();
+
+ JPushInterface.init(mContext);
+
+ cordovaActivity = cordova.getActivity();
+
+ // 如果同时缓存了打开事件 openNotificationAlert 和 消息事件 notificationAlert,只向 UI 发打开事件。
+ // 这样做是为了和 iOS 统一。
+ if (openNotificationAlert != null) {
+ notificationAlert = null;
+ transmitNotificationOpen(openNotificationTitle, openNotificationAlert, openNotificationExtras);
+ }
+ if (notificationAlert != null) {
+ transmitNotificationReceive(notificationTitle, notificationAlert, notificationExtras);
+ }
+ }
+
+ public void onResume(boolean multitasking) {
+ if (openNotificationAlert != null) {
+ notificationAlert = null;
+ transmitNotificationOpen(openNotificationTitle, openNotificationAlert, openNotificationExtras);
+ }
+ if (notificationAlert != null) {
+ transmitNotificationReceive(notificationTitle, notificationAlert, notificationExtras);
+ }
+ }
+
+ @Override
+ public void onDestroy() {
+ super.onDestroy();
+ cordovaActivity = null;
+ instance = null;
+ }
+
+ private static JSONObject getMessageObject(String message, Map<String, Object> extras) {
+ JSONObject data = new JSONObject();
+ try {
+ data.put("message", message);
+ JSONObject jExtras = new JSONObject();
+ for (Entry<String, Object> entry : extras.entrySet()) {
+ if (entry.getKey().equals("cn.jpush.android.EXTRA")) {
+ JSONObject jo;
+ if (TextUtils.isEmpty((String) entry.getValue())) {
+ jo = new JSONObject();
+ } else {
+ jo = new JSONObject((String) entry.getValue());
+ String key;
+ Iterator keys = jo.keys();
+ while (keys.hasNext()) {
+ key = keys.next().toString();
+ jExtras.put(key, jo.getString(key));
+ }
+ }
+ jExtras.put("cn.jpush.android.EXTRA", jo);
+ } else {
+ jExtras.put(entry.getKey(), entry.getValue());
+ }
+ }
+ if (jExtras.length() > 0) {
+ data.put("extras", jExtras);
+ }
+ } catch (JSONException e) {
+ e.printStackTrace();
+ }
+ return data;
+ }
+
+ private static JSONObject getNotificationObject(String title, String alert, Map<String, Object> extras) {
+ JSONObject data = new JSONObject();
+ try {
+ data.put("title", title);
+ data.put("alert", alert);
+ JSONObject jExtras = new JSONObject();
+ for (Entry<String, Object> entry : extras.entrySet()) {
+ if (entry.getKey().equals("cn.jpush.android.EXTRA")) {
+ JSONObject jo;
+ if (TextUtils.isEmpty((String) entry.getValue())) {
+ jo = new JSONObject();
+ } else {
+ jo = new JSONObject((String) entry.getValue());
+ String key;
+ Iterator keys = jo.keys();
+ while (keys.hasNext()) {
+ key = keys.next().toString();
+ jExtras.put(key, jo.getString(key));
+ }
+ }
+ jExtras.put("cn.jpush.android.EXTRA", jo);
+ } else {
+ jExtras.put(entry.getKey(), entry.getValue());
+ }
+ }
+ if (jExtras.length() > 0) {
+ data.put("extras", jExtras);
+ }
+ } catch (JSONException e) {
+ e.printStackTrace();
+ }
+ return data;
+ }
+
+ static void transmitMessageReceive(String message, Map<String, Object> extras) {
+ if (instance == null) {
+ return;
+ }
+ JSONObject data = getMessageObject(message, extras);
+ String format = "window.plugins.jPushPlugin.receiveMessageInAndroidCallback(%s);";
+ final String js = String.format(format, data.toString());
+ cordovaActivity.runOnUiThread(new Runnable() {
+ @Override
+ public void run() {
+ instance.webView.loadUrl("javascript:" + js);
+ }
+ });
+ }
+
+ static void transmitNotificationOpen(String title, String alert, Map<String, Object> extras) {
+ if (instance == null) {
+ return;
+ }
+ JSONObject data = getNotificationObject(title, alert, extras);
+ String format = "window.plugins.jPushPlugin.openNotificationInAndroidCallback(%s);";
+ final String js = String.format(format, data.toString());
+ cordovaActivity.runOnUiThread(new Runnable() {
+ @Override
+ public void run() {
+ instance.webView.loadUrl("javascript:" + js);
+ }
+ });
+ JPushPlugin.openNotificationTitle = null;
+ JPushPlugin.openNotificationAlert = null;
+ }
+
+ static void transmitNotificationReceive(String title, String alert, Map<String, Object> extras) {
+ if (instance == null) {
+ return;
+ }
+ JSONObject data = getNotificationObject(title, alert, extras);
+ String format = "window.plugins.jPushPlugin.receiveNotificationInAndroidCallback(%s);";
+ final String js = String.format(format, data.toString());
+ cordovaActivity.runOnUiThread(new Runnable() {
+ @Override
+ public void run() {
+ instance.webView.loadUrl("javascript:" + js);
+ }
+ });
+ JPushPlugin.notificationTitle = null;
+ JPushPlugin.notificationAlert = null;
+ }
+
+ static void transmitReceiveRegistrationId(String rId) {
+ if (instance == null) {
+ return;
+ }
+ JSONObject data = new JSONObject();
+ try {
+ data.put("registrationId", rId);
+ } catch (JSONException e) {
+ e.printStackTrace();
+ }
+ String format = "window.plugins.jPushPlugin.receiveRegistrationIdInAndroidCallback(%s);";
+ final String js = String.format(format, data.toString());
+ cordovaActivity.runOnUiThread(new Runnable() {
+ @Override
+ public void run() {
+ instance.webView.loadUrl("javascript:" + js);
+ }
+ });
+ }
+
+ @Override
+ public boolean execute(final String action, final JSONArray data, final CallbackContext callbackContext)
+ throws JSONException {
+ cordova.getThreadPool().execute(new Runnable() {
+ @Override
+ public void run() {
+ try {
+ Method method = JPushPlugin.class.getDeclaredMethod(action, JSONArray.class, CallbackContext.class);
+ method.invoke(JPushPlugin.this, data, callbackContext);
+ } catch (Exception e) {
+ Log.e(TAG, e.toString());
+ }
+ }
+ });
+ return true;
+ }
+
+ void init(JSONArray data, CallbackContext callbackContext) {
+ JPushInterface.init(mContext);
+ }
+
+ void setDebugMode(JSONArray data, CallbackContext callbackContext) {
+ boolean mode;
+ try {
+ mode = data.getBoolean(0);
+ JPushInterface.setDebugMode(mode);
+ callbackContext.success();
+ } catch (JSONException e) {
+ e.printStackTrace();
+ }
+ }
+
+ void stopPush(JSONArray data, CallbackContext callbackContext) {
+ JPushInterface.stopPush(mContext);
+ callbackContext.success();
+ }
+
+ void resumePush(JSONArray data, CallbackContext callbackContext) {
+ JPushInterface.resumePush(mContext);
+ callbackContext.success();
+ }
+
+ void isPushStopped(JSONArray data, CallbackContext callbackContext) {
+ boolean isStopped = JPushInterface.isPushStopped(mContext);
+ if (isStopped) {
+ callbackContext.success(1);
+ } else {
+ callbackContext.success(0);
+ }
+ }
+
+ void areNotificationEnabled(JSONArray data, final CallbackContext callback) {
+ int isEnabled;
+ if (hasPermission("OP_POST_NOTIFICATION")) {
+ isEnabled = 1;
+ } else {
+ isEnabled = 0;
+ }
+ callback.success(isEnabled);
+ }
+
+ void setLatestNotificationNum(JSONArray data, CallbackContext callbackContext) {
+ int num = -1;
+ try {
+ num = data.getInt(0);
+ } catch (JSONException e) {
+ e.printStackTrace();
+ callbackContext.error("error reading num json");
+ }
+ if (num != -1) {
+ JPushInterface.setLatestNotificationNumber(mContext, num);
+ } else {
+ callbackContext.error("error num");
+ }
+ }
+
+ void setPushTime(JSONArray data, CallbackContext callbackContext) {
+ Set<Integer> days = new HashSet<Integer>();
+ JSONArray dayArray;
+ int startHour = -1;
+ int endHour = -1;
+ try {
+ dayArray = data.getJSONArray(0);
+ for (int i = 0; i < dayArray.length(); i++) {
+ days.add(dayArray.getInt(i));
+ }
+ } catch (JSONException e) {
+ e.printStackTrace();
+ callbackContext.error("error reading days json");
+ }
+ try {
+ startHour = data.getInt(1);
+ endHour = data.getInt(2);
+ } catch (JSONException e) {
+ callbackContext.error("error reading hour json");
+ }
+ Context context = mContext;
+ JPushInterface.setPushTime(context, days, startHour, endHour);
+ callbackContext.success();
+ }
+
+ void getRegistrationID(JSONArray data, CallbackContext callbackContext) {
+ Context context = mContext;
+ String regID = JPushInterface.getRegistrationID(context);
+ callbackContext.success(regID);
+ }
+
+ void onResume(JSONArray data, CallbackContext callbackContext) {
+ JPushInterface.onResume(this.cordova.getActivity());
+ }
+
+ void onPause(JSONArray data, CallbackContext callbackContext) {
+ JPushInterface.onPause(this.cordova.getActivity());
+ }
+
+ void reportNotificationOpened(JSONArray data, CallbackContext callbackContext) {
+ try {
+ String msgID;
+ msgID = data.getString(0);
+ JPushInterface.reportNotificationOpened(this.cordova.getActivity(), msgID);
+ } catch (JSONException e) {
+ e.printStackTrace();
+ }
+ }
+
+ void setAlias(JSONArray data, CallbackContext callbackContext) {
+ int sequence = -1;
+ String alias = null;
+
+ try {
+ JSONObject params = data.getJSONObject(0);
+ sequence = params.getInt("sequence");
+ alias = params.getString("alias");
+ } catch (JSONException e) {
+ e.printStackTrace();
+ callbackContext.error("Parameters error.");
+ }
+
+ JPushInterface.setAlias(mContext, sequence, alias);
+ eventCallbackMap.put(sequence, callbackContext);
+ }
+
+ void deleteAlias(JSONArray data, CallbackContext callbackContext) {
+ int sequence = -1;
+
+ try {
+ JSONObject params = data.getJSONObject(0);
+ sequence = params.getInt("sequence");
+ } catch (JSONException e) {
+ e.printStackTrace();
+ callbackContext.error("Parameters error.");
+ }
+
+ JPushInterface.deleteAlias(mContext, sequence);
+ eventCallbackMap.put(sequence, callbackContext);
+ }
+
+ void getAlias(JSONArray data, CallbackContext callbackContext) {
+ int sequence = -1;
+
+ try {
+ JSONObject params = data.getJSONObject(0);
+ sequence = params.getInt("sequence");
+ } catch (JSONException e) {
+ e.printStackTrace();
+ callbackContext.error("Parameters error.");
+ }
+
+ JPushInterface.getAlias(mContext, sequence);
+ eventCallbackMap.put(sequence, callbackContext);
+ }
+
+ void setTags(JSONArray data, CallbackContext callbackContext) {
+ int sequence = -1;
+ Set<String> tags = new HashSet<String>();
+
+ try {
+ JSONObject params = data.getJSONObject(0);
+ sequence = params.getInt("sequence");
+
+ JSONArray tagsArr = params.getJSONArray("tags");
+ for (int i = 0; i < tagsArr.length(); i++) {
+ tags.add(tagsArr.getString(i));
+ }
+
+ } catch (JSONException e) {
+ e.printStackTrace();
+ callbackContext.error("Parameters error.");
+ }
+
+ JPushInterface.setTags(mContext, sequence, tags);
+ eventCallbackMap.put(sequence, callbackContext);
+ }
+
+ void addTags(JSONArray data, CallbackContext callbackContext) {
+ int sequence = -1;
+ Set<String> tags = new HashSet<String>();
+
+ try {
+ JSONObject params = data.getJSONObject(0);
+ sequence = params.getInt("sequence");
+
+ JSONArray tagsArr = params.getJSONArray("tags");
+ for (int i = 0; i < tagsArr.length(); i++) {
+ tags.add(tagsArr.getString(i));
+ }
+
+ } catch (JSONException e) {
+ e.printStackTrace();
+ callbackContext.error("Parameters error.");
+ }
+
+ JPushInterface.addTags(mContext, sequence, tags);
+ eventCallbackMap.put(sequence, callbackContext);
+ }
+
+ void deleteTags(JSONArray data, CallbackContext callbackContext) {
+ int sequence = -1;
+ Set<String> tags = new HashSet<String>();
+
+ try {
+ JSONObject params = data.getJSONObject(0);
+ sequence = params.getInt("sequence");
+
+ JSONArray tagsArr = params.getJSONArray("tags");
+ for (int i = 0; i < tagsArr.length(); i++) {
+ tags.add(tagsArr.getString(i));
+ }
+
+ } catch (JSONException e) {
+ e.printStackTrace();
+ callbackContext.error("Parameters error.");
+ }
+
+ JPushInterface.deleteTags(mContext, sequence, tags);
+ eventCallbackMap.put(sequence, callbackContext);
+ }
+
+ void cleanTags(JSONArray data, CallbackContext callbackContext) {
+ int sequence = -1;
+
+ try {
+ JSONObject params = data.getJSONObject(0);
+ sequence = params.getInt("sequence");
+
+ } catch (JSONException e) {
+ e.printStackTrace();
+ callbackContext.error("Parameters error.");
+ }
+
+ JPushInterface.cleanTags(mContext, sequence);
+ eventCallbackMap.put(sequence, callbackContext);
+ }
+
+ void getAllTags(JSONArray data, CallbackContext callbackContext) {
+ int sequence = -1;
+
+ try {
+ JSONObject params = data.getJSONObject(0);
+ sequence = params.getInt("sequence");
+
+ } catch (JSONException e) {
+ e.printStackTrace();
+ callbackContext.error("Parameters error.");
+ }
+
+ JPushInterface.getAllTags(mContext, sequence);
+ eventCallbackMap.put(sequence, callbackContext);
+ }
+
+ void checkTagBindState(JSONArray data, CallbackContext callbackContext) {
+ int sequence = -1;
+ String tag = null;
+
+ try {
+ JSONObject params = data.getJSONObject(0);
+ sequence = params.getInt("sequence");
+ tag = params.getString("tag");
+
+ } catch (JSONException e) {
+ e.printStackTrace();
+ callbackContext.error("Parameters error.");
+ }
+
+ JPushInterface.checkTagBindState(mContext, sequence, tag);
+ eventCallbackMap.put(sequence, callbackContext);
+ }
+
+ void getConnectionState(JSONArray data, CallbackContext callback) {
+ boolean isConnected = JPushInterface.getConnectionState(cordovaActivity.getApplicationContext());
+ if (isConnected) {
+ callback.success(1);
+ } else {
+ callback.success(0);
+ }
+ }
+
+ /**
+ * 自定义通知行为,声音、震动、呼吸灯等。
+ */
+ void setBasicPushNotificationBuilder(JSONArray data, CallbackContext callbackContext) {
+ BasicPushNotificationBuilder builder = new BasicPushNotificationBuilder(this.cordova.getActivity());
+ builder.developerArg0 = "Basic builder 1";
+ JPushInterface.setPushNotificationBuilder(1, builder);
+ JSONObject obj = new JSONObject();
+ try {
+ obj.put("id", 1);
+ } catch (JSONException e) {
+ e.printStackTrace();
+ }
+ }
+
+ /**
+ * 自定义推送通知栏样式,需要自己实现具体代码。 http://docs.jiguang.cn/client/android_tutorials/#_11
+ */
+ void setCustomPushNotificationBuilder(JSONArray data, CallbackContext callbackContext) {
+ // CustomPushNotificationBuilder builder = new CustomPushNotificationBuilder(
+ // this.cordova.getActivity(), R.layout.test_notification_layout,
+ // R.id.icon, R.id.title, R.id.text);
+ // JPushInterface.setPushNotificationBuilder(2, builder);
+ // JPushInterface.setDefaultPushNotificationBuilder(builder);
+ }
+
+ void clearAllNotification(JSONArray data, CallbackContext callbackContext) {
+ JPushInterface.clearAllNotifications(this.cordova.getActivity());
+ }
+
+ void clearNotificationById(JSONArray data, CallbackContext callbackContext) {
+ int notificationId = -1;
+ try {
+ notificationId = data.getInt(0);
+ } catch (JSONException e) {
+ e.printStackTrace();
+ callbackContext.error("error reading id json");
+ return;
+ }
+ if (notificationId != -1) {
+ JPushInterface.clearNotificationById(this.cordova.getActivity(), notificationId);
+ } else {
+ callbackContext.error("error id");
+ }
+ }
+
+ void addLocalNotification(JSONArray data, CallbackContext callbackContext) throws JSONException {
+ int builderId = data.getInt(0);
+ String content = data.getString(1);
+ String title = data.getString(2);
+ int notificationID = data.getInt(3);
+ int broadcastTime = data.getInt(4);
+ String extrasStr = data.isNull(5) ? "" : data.getString(5);
+ JSONObject extras = new JSONObject();
+ if (!extrasStr.isEmpty()) {
+ extras = new JSONObject(extrasStr);
+ }
+
+ JPushLocalNotification ln = new JPushLocalNotification();
+ ln.setBuilderId(builderId);
+ ln.setContent(content);
+ ln.setTitle(title);
+ ln.setNotificationId(notificationID);
+ ln.setBroadcastTime(System.currentTimeMillis() + broadcastTime);
+ ln.setExtras(extras.toString());
+
+ JPushInterface.addLocalNotification(this.cordova.getActivity(), ln);
+ }
+
+ void removeLocalNotification(JSONArray data, CallbackContext callbackContext) throws JSONException {
+ int notificationID = data.getInt(0);
+ JPushInterface.removeLocalNotification(this.cordova.getActivity(), notificationID);
+ }
+
+ void clearLocalNotifications(JSONArray data, CallbackContext callbackContext) {
+ JPushInterface.clearLocalNotifications(this.cordova.getActivity());
+ }
+
+ /**
+ * 设置通知静默时间 http://docs.jpush.io/client/android_api/#api_5
+ */
+ void setSilenceTime(JSONArray data, CallbackContext callbackContext) {
+ try {
+ int startHour = data.getInt(0);
+ int startMinute = data.getInt(1);
+ int endHour = data.getInt(2);
+ int endMinute = data.getInt(3);
+ if (!isValidHour(startHour) || !isValidMinute(startMinute)) {
+ callbackContext.error("开始时间数值错误");
+ return;
+ }
+ if (!isValidHour(endHour) || !isValidMinute(endMinute)) {
+ callbackContext.error("结束时间数值错误");
+ return;
+ }
+ JPushInterface.setSilenceTime(this.cordova.getActivity(), startHour, startMinute, endHour, endMinute);
+ } catch (JSONException e) {
+ e.printStackTrace();
+ callbackContext.error("error: reading json data.");
+ }
+ }
+
+ 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);
+ }
+
+ private boolean isValidMinute(int minute) {
+ return !(minute < 0 || minute > 59);
+ }
+
+ /**
+ * 用于 Android 6.0 以上系统申请权限,具体可参考:
+ * http://docs.Push.io/client/android_api/#android-60
+ */
+ void requestPermission(JSONArray data, CallbackContext callbackContext) {
+ JPushInterface.requestPermission(this.cordova.getActivity());
+ }
+
+ private final TagAliasCallback mTagWithAliasCallback = new TagAliasCallback() {
+ @Override
+ public void gotResult(int code, String alias, Set<String> tags) {
+ if (instance == null) {
+ return;
+ }
+ JSONObject data = new JSONObject();
+ try {
+ data.put("resultCode", code);
+ data.put("tags", tags);
+ data.put("alias", alias);
+ final String jsEvent = String.format("cordova.fireDocumentEvent('jpush.setTagsWithAlias',%s)",
+ data.toString());
+ cordova.getActivity().runOnUiThread(new Runnable() {
+ @Override
+ public void run() {
+ instance.webView.loadUrl("javascript:" + jsEvent);
+ }
+ });
+ } catch (JSONException e) {
+ e.printStackTrace();
+ }
+ }
+ };
+
+ private boolean hasPermission(String appOpsServiceId) {
+
+ Context context = cordova.getActivity().getApplicationContext();
+ if (Build.VERSION.SDK_INT >= 24) {
+ NotificationManager mNotificationManager = (NotificationManager) context
+ .getSystemService(Context.NOTIFICATION_SERVICE);
+ return mNotificationManager.areNotificationsEnabled();
+ } else {
+ AppOpsManager mAppOps = (AppOpsManager) context.getSystemService(Context.APP_OPS_SERVICE);
+ ApplicationInfo appInfo = context.getApplicationInfo();
+
+ String pkg = context.getPackageName();
+ int uid = appInfo.uid;
+ Class appOpsClazz;
+
+ try {
+ appOpsClazz = Class.forName(AppOpsManager.class.getName());
+ Method checkOpNoThrowMethod = appOpsClazz.getMethod("checkOpNoThrow", Integer.TYPE, Integer.TYPE,
+ String.class);
+ Field opValue = appOpsClazz.getDeclaredField(appOpsServiceId);
+ int value = opValue.getInt(Integer.class);
+ Object result = checkOpNoThrowMethod.invoke(mAppOps, value, uid, pkg);
+ return Integer.parseInt(result.toString()) == AppOpsManager.MODE_ALLOWED;
+ } catch (InvocationTargetException e) {
+ e.printStackTrace();
+ } catch (IllegalAccessException e) {
+ e.printStackTrace();
+ } catch (NoSuchMethodException e) {
+ e.printStackTrace();
+ } catch (NoSuchFieldException e) {
+ e.printStackTrace();
+ } catch (ClassNotFoundException e) {
+ e.printStackTrace();
+ }
+ }
+
+ return false;
+ }
+
+}
diff --git a/platforms/android/app/src/main/java/cn/jiguang/cordova/push/JPushReceiver.java b/platforms/android/app/src/main/java/cn/jiguang/cordova/push/JPushReceiver.java
new file mode 100644
index 0000000..806a7fc
--- /dev/null
+++ b/platforms/android/app/src/main/java/cn/jiguang/cordova/push/JPushReceiver.java
@@ -0,0 +1,86 @@
+package cn.jiguang.cordova.push;
+
+import android.content.BroadcastReceiver;
+import android.content.Context;
+import android.content.Intent;
+
+import java.util.Arrays;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+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","key_show_entity","platform");
+
+ @Override
+ public void onReceive(Context context, Intent intent) {
+ String action = intent.getAction();
+ if (action.equals(JPushInterface.ACTION_REGISTRATION_ID)) {
+ String rId = intent.getStringExtra(JPushInterface.EXTRA_REGISTRATION_ID);
+ JPushPlugin.transmitReceiveRegistrationId(rId);
+ } else if (action.equals(JPushInterface.ACTION_MESSAGE_RECEIVED)) {
+ handlingMessageReceive(intent);
+ } else if (action.equals(JPushInterface.ACTION_NOTIFICATION_RECEIVED)) {
+ handlingNotificationReceive(context, intent);
+ } else if (action.equals(JPushInterface.ACTION_NOTIFICATION_OPENED)) {
+ handlingNotificationOpen(context, intent);
+ }
+ }
+
+ private void handlingMessageReceive(Intent intent) {
+ String msg = intent.getStringExtra(JPushInterface.EXTRA_MESSAGE);
+ Map<String, Object> extras = getNotificationExtras(intent);
+ JPushPlugin.transmitMessageReceive(msg, extras);
+ }
+
+ private void handlingNotificationOpen(Context context, Intent intent) {
+ String title = intent.getStringExtra(JPushInterface.EXTRA_NOTIFICATION_TITLE);
+ JPushPlugin.openNotificationTitle = title;
+
+ String alert = intent.getStringExtra(JPushInterface.EXTRA_ALERT);
+ JPushPlugin.openNotificationAlert = alert;
+
+ Map<String, Object> extras = getNotificationExtras(intent);
+ JPushPlugin.openNotificationExtras = extras;
+
+ JPushPlugin.transmitNotificationOpen(title, alert, extras);
+
+ Intent launch = context.getPackageManager().getLaunchIntentForPackage(context.getPackageName());
+ if (launch != null) {
+ launch.addCategory(Intent.CATEGORY_LAUNCHER);
+ launch.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_SINGLE_TOP);
+ context.startActivity(launch);
+ }
+ }
+
+ private void handlingNotificationReceive(Context context, Intent intent) {
+ String title = intent.getStringExtra(JPushInterface.EXTRA_NOTIFICATION_TITLE);
+ JPushPlugin.notificationTitle = title;
+
+ String alert = intent.getStringExtra(JPushInterface.EXTRA_ALERT);
+ JPushPlugin.notificationAlert = alert;
+
+ Map<String, Object> extras = getNotificationExtras(intent);
+ JPushPlugin.notificationExtras = extras;
+
+ JPushPlugin.transmitNotificationReceive(title, alert, extras);
+ }
+
+ private Map<String, Object> getNotificationExtras(Intent intent) {
+ Map<String, Object> extrasMap = new HashMap<String, Object>();
+ for (String key : intent.getExtras().keySet()) {
+ if (!IGNORED_EXTRAS_KEYS.contains(key)) {
+ if (key.equals(JPushInterface.EXTRA_NOTIFICATION_ID)) {
+ extrasMap.put(key, intent.getIntExtra(key, 0));
+ } else {
+ extrasMap.put(key, intent.getStringExtra(key));
+ }
+ }
+ }
+ return extrasMap;
+ }
+}
diff --git a/platforms/android/app/src/main/java/cn/jiguang/cordova/push/PushService.java b/platforms/android/app/src/main/java/cn/jiguang/cordova/push/PushService.java
new file mode 100644
index 0000000..2b0974e
--- /dev/null
+++ b/platforms/android/app/src/main/java/cn/jiguang/cordova/push/PushService.java
@@ -0,0 +1,6 @@
+package cn.jiguang.cordova.push;
+
+import cn.jpush.android.service.JCommonService;
+
+public class PushService extends JCommonService {
+}
diff --git a/platforms/android/app/src/main/jniLibs/arm64-v8a/libjcore212.so b/platforms/android/app/src/main/jniLibs/arm64-v8a/libjcore212.so
new file mode 100755
index 0000000..7c7a83e
--- /dev/null
+++ b/platforms/android/app/src/main/jniLibs/arm64-v8a/libjcore212.so
Binary files differ
diff --git a/platforms/android/app/src/main/jniLibs/armeabi-v7a/libjcore212.so b/platforms/android/app/src/main/jniLibs/armeabi-v7a/libjcore212.so
new file mode 100755
index 0000000..d09da8e
--- /dev/null
+++ b/platforms/android/app/src/main/jniLibs/armeabi-v7a/libjcore212.so
Binary files differ
diff --git a/platforms/android/app/src/main/jniLibs/armeabi/libjcore212.so b/platforms/android/app/src/main/jniLibs/armeabi/libjcore212.so
new file mode 100755
index 0000000..0106c5a
--- /dev/null
+++ b/platforms/android/app/src/main/jniLibs/armeabi/libjcore212.so
Binary files differ
diff --git a/platforms/android/app/src/main/jniLibs/mips/libjcore212.so b/platforms/android/app/src/main/jniLibs/mips/libjcore212.so
new file mode 100755
index 0000000..5110f46
--- /dev/null
+++ b/platforms/android/app/src/main/jniLibs/mips/libjcore212.so
Binary files differ
diff --git a/platforms/android/app/src/main/jniLibs/mips64/libjcore212.so b/platforms/android/app/src/main/jniLibs/mips64/libjcore212.so
new file mode 100755
index 0000000..1df557b
--- /dev/null
+++ b/platforms/android/app/src/main/jniLibs/mips64/libjcore212.so
Binary files differ
diff --git a/platforms/android/app/src/main/jniLibs/x86/libjcore212.so b/platforms/android/app/src/main/jniLibs/x86/libjcore212.so
new file mode 100755
index 0000000..8eae348
--- /dev/null
+++ b/platforms/android/app/src/main/jniLibs/x86/libjcore212.so
Binary files differ
diff --git a/platforms/android/app/src/main/jniLibs/x86_64/libjcore212.so b/platforms/android/app/src/main/jniLibs/x86_64/libjcore212.so
new file mode 100755
index 0000000..c935dca
--- /dev/null
+++ b/platforms/android/app/src/main/jniLibs/x86_64/libjcore212.so
Binary files differ
diff --git a/platforms/android/app/src/main/res/drawable-hdpi/jpush_ic_richpush_actionbar_back.png b/platforms/android/app/src/main/res/drawable-hdpi/jpush_ic_richpush_actionbar_back.png
new file mode 100755
index 0000000..c9f4e4d
--- /dev/null
+++ b/platforms/android/app/src/main/res/drawable-hdpi/jpush_ic_richpush_actionbar_back.png
Binary files differ
diff --git a/platforms/android/app/src/main/res/drawable-hdpi/jpush_ic_richpush_actionbar_divider.png b/platforms/android/app/src/main/res/drawable-hdpi/jpush_ic_richpush_actionbar_divider.png
new file mode 100755
index 0000000..f289651
--- /dev/null
+++ b/platforms/android/app/src/main/res/drawable-hdpi/jpush_ic_richpush_actionbar_divider.png
Binary files differ
diff --git a/platforms/android/app/src/main/res/drawable/jpush_richpush_btn_selector.xml b/platforms/android/app/src/main/res/drawable/jpush_richpush_btn_selector.xml
new file mode 100755
index 0000000..c6dd002
--- /dev/null
+++ b/platforms/android/app/src/main/res/drawable/jpush_richpush_btn_selector.xml
@@ -0,0 +1,21 @@
+<?xml version="1.0" encoding="utf-8"?>
+<selector xmlns:android="http://schemas.android.com/apk/res/android" >
+ <!-- 获得焦点但未按下时的背景图片 -->
+ <item
+ android:state_focused="true"
+ android:state_enabled="true"
+ android:state_pressed="false"
+ android:drawable="@drawable/jpush_ic_richpush_actionbar_back" />
+ <!-- 按下时的背景图片 -->
+ <item
+ android:state_enabled="true"
+ android:state_pressed="true"
+ android:drawable="@android:color/darker_gray" />
+ <!-- 按下时的背景图片 -->
+ <item
+ android:state_enabled="true"
+ android:state_checked="true"
+ android:drawable="@android:color/darker_gray" />
+ <!-- 默认时的背景图片 -->
+ <item android:drawable="@drawable/jpush_ic_richpush_actionbar_back" />
+</selector>
\ No newline at end of file
diff --git a/platforms/android/app/src/main/res/drawable/jpush_richpush_progressbar.xml b/platforms/android/app/src/main/res/drawable/jpush_richpush_progressbar.xml
new file mode 100755
index 0000000..a1d9b8f
--- /dev/null
+++ b/platforms/android/app/src/main/res/drawable/jpush_richpush_progressbar.xml
@@ -0,0 +1,20 @@
+<?xml version="1.0" encoding="utf-8"?>
+<layer-list xmlns:android="http://schemas.android.com/apk/res/android" >
+
+ <!-- 背景 gradient是渐变,corners定义的是圆角 -->
+ <item android:id="@android:id/background">
+ <shape>
+ <solid android:color="#ffffff" />
+ </shape>
+ </item>
+
+ <!-- 进度条 -->
+ <item android:id="@android:id/progress">
+ <clip>
+ <shape>
+ <solid android:color="#4393ea" />
+ </shape>
+ </clip>
+ </item>
+
+</layer-list>
\ No newline at end of file
diff --git a/platforms/android/app/src/main/res/layout/jpush_popwin_layout.xml b/platforms/android/app/src/main/res/layout/jpush_popwin_layout.xml
new file mode 100755
index 0000000..f43e478
--- /dev/null
+++ b/platforms/android/app/src/main/res/layout/jpush_popwin_layout.xml
@@ -0,0 +1,15 @@
+<?xml version="1.0" encoding="utf-8"?>
+<LinearLayout
+ xmlns:android="http://schemas.android.com/apk/res/android"
+ android:id="@+id/popLayoutId"
+ style="@style/MyDialogStyle"
+ android:orientation="vertical"
+ android:layout_width="280dp"
+ android:layout_height="250dp" >
+
+ <WebView
+ android:layout_width="match_parent"
+ android:layout_height="match_parent"
+ android:id="@+id/wvPopwin"/>
+
+</LinearLayout>
\ No newline at end of file
diff --git a/platforms/android/app/src/main/res/layout/jpush_webview_layout.xml b/platforms/android/app/src/main/res/layout/jpush_webview_layout.xml
new file mode 100755
index 0000000..bebdd61
--- /dev/null
+++ b/platforms/android/app/src/main/res/layout/jpush_webview_layout.xml
@@ -0,0 +1,59 @@
+<?xml version="1.0" encoding="utf-8"?>
+<cn.jpush.android.ui.FullScreenView xmlns:android="http://schemas.android.com/apk/res/android"
+ android:id="@+id/actionbarLayoutId"
+ android:layout_width="match_parent"
+ android:layout_height="match_parent"
+ android:orientation="vertical" >
+
+ <RelativeLayout
+ android:id="@+id/rlRichpushTitleBar"
+ android:layout_width="match_parent"
+ android:layout_height="40.0dp"
+ android:background="#29313a">
+
+ <ImageButton
+ android:id="@+id/imgRichpushBtnBack"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:layout_centerVertical="true"
+ android:layout_marginLeft="9dp"
+ android:layout_marginRight="10dp"
+ android:background="@drawable/jpush_richpush_btn_selector" />
+
+ <ImageView
+ android:id="@+id/imgView"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:layout_centerVertical="true"
+ android:layout_toRightOf="@id/imgRichpushBtnBack"
+ android:clickable="false"
+ android:src="@drawable/jpush_ic_richpush_actionbar_divider" />
+
+ <TextView
+ android:id="@+id/tvRichpushTitle"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:layout_centerVertical="true"
+ android:layout_marginLeft="7dp"
+ android:layout_marginRight="5dp"
+ android:layout_toRightOf="@id/imgView"
+ android:clickable="false"
+ android:text=" "
+ android:textSize="20sp"
+ android:textColor="#ffffff" />
+ </RelativeLayout>
+
+ <ProgressBar
+ android:id="@+id/pushPrograssBar"
+ android:layout_width="match_parent"
+ android:layout_height="1dp"
+ android:progress="0"
+ android:progressDrawable="@drawable/jpush_richpush_progressbar"
+ style="?android:attr/progressBarStyleHorizontal" />
+ <WebView
+ android:layout_width="match_parent"
+ android:layout_height="match_parent"
+ android:id="@+id/fullWebView"
+ android:background="#000000" />
+
+</cn.jpush.android.ui.FullScreenView>
\ No newline at end of file
diff --git a/platforms/android/app/src/main/res/layout/push_notification.xml b/platforms/android/app/src/main/res/layout/push_notification.xml
new file mode 100755
index 0000000..299ea09
--- /dev/null
+++ b/platforms/android/app/src/main/res/layout/push_notification.xml
@@ -0,0 +1,172 @@
+<?xml version="1.0" encoding="utf-8"?>
+<RelativeLayout
+ android:id="@+id/push_root_view"
+ xmlns:android="http://schemas.android.com/apk/res/android"
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:paddingBottom="4dp"
+ android:paddingTop="2dp"
+ android:paddingLeft="8dp"
+ android:paddingRight="8dp"
+ >
+
+ <ImageView
+ android:id="@+id/push_notification_bg"
+ android:layout_width="match_parent"
+ android:layout_height="match_parent"
+ android:scaleType="centerCrop"/>
+ <RelativeLayout
+ android:id="@+id/push_notification_style_default"
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content">
+ <LinearLayout
+ android:id="@+id/push_notification_layout_lefttop"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:layout_alignParentTop="true"
+ android:layout_alignParentLeft="true"
+ android:layout_toLeftOf="@+id/push_notification_big_icon"
+ android:gravity="center_vertical"
+ android:orientation="horizontal">
+ <ImageView
+ android:id="@+id/push_notification_small_icon"
+ android:layout_width="18dp"
+ android:layout_height="18dp"
+ android:layout_marginLeft="6dp"
+ android:scaleType="centerInside"/>
+ <TextView
+ android:id="@+id/push_notification_title"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:layout_marginLeft="4dp"
+ android:maxLines="1"
+ android:maxWidth="200dp"
+ android:maxLength="24"
+ android:textColor="@android:color/black"
+ android:textSize="12sp"/>
+ <TextView
+ android:id="@+id/push_notification_dot"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:layout_marginLeft="4dp"
+ android:text="· "
+ android:textColor="@android:color/black"
+ android:textSize="20sp"/>
+ <TextView
+ android:maxLines="1"
+ android:id="@+id/push_notification_date"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:textColor="@android:color/black"
+ android:textSize="12sp"
+ />
+ </LinearLayout>
+
+
+ <ImageView
+ android:id="@+id/push_notification_big_icon"
+ android:layout_width="48dp"
+ android:layout_height="48dp"
+ android:layout_alignParentRight="true"
+ android:layout_centerVertical="true"
+ android:layout_marginRight="8dp"
+ android:scaleType="centerInside"/>
+
+ <TextView
+ android:id="@+id/push_notification_sub_title"
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:textColor="@android:color/black"
+ android:layout_below="@id/push_notification_layout_lefttop"
+ android:layout_toLeftOf="@+id/push_notification_big_icon"
+ android:layout_marginLeft="6dp"
+ android:layout_marginRight="4dp"
+ android:visibility="gone"
+ android:layout_marginTop="1dp"
+ android:textSize="13sp"
+ android:maxLines="1"
+ />
+
+ <TextView
+ android:id="@+id/push_notification_content"
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:textColor="@android:color/black"
+ android:layout_below="@id/push_notification_sub_title"
+ android:layout_toLeftOf="@+id/push_notification_big_icon"
+ android:layout_marginLeft="6dp"
+ android:layout_marginRight="4dp"
+ android:layout_marginTop="1dp"
+ android:textSize="13sp"
+ android:maxLines="2"
+ android:ellipsize="end"
+ />
+ <TextView
+ android:id="@+id/push_notification_content_one_line"
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:visibility="gone"
+ android:textColor="@android:color/black"
+ android:layout_below="@id/push_notification_sub_title"
+ android:layout_toLeftOf="@+id/push_notification_big_icon"
+ android:layout_marginLeft="6dp"
+ android:layout_marginRight="4dp"
+ android:layout_marginTop="1dp"
+ android:textSize="13sp"
+ android:maxLines="1"
+ android:ellipsize="end"
+ />
+ </RelativeLayout>
+ <RelativeLayout
+ android:id="@+id/push_notification_style_1"
+ android:visibility="gone"
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content">
+ <ImageView
+ android:id="@+id/push_notification_style_1_big_icon"
+ android:layout_width="50dp"
+ android:layout_height="50dp"
+ android:layout_alignParentLeft="true"
+ android:layout_centerVertical="true"
+ android:scaleType="centerInside"/>
+ <LinearLayout
+ android:layout_marginLeft="6dp"
+ android:layout_toRightOf="@+id/push_notification_style_1_big_icon"
+ android:orientation="vertical"
+ android:layout_centerVertical="true"
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content">
+ <RelativeLayout
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content">
+ <TextView
+ android:id="@+id/push_notification_style_1_date"
+ android:textSize="12sp"
+ android:layout_alignParentRight="true"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content" />
+ <TextView
+ android:id="@+id/push_notification_style_1_title"
+ android:layout_alignParentLeft="true"
+ android:layout_toLeftOf="@+id/push_notification_style_1_date"
+ android:textSize="12sp"
+ android:textStyle="bold"
+ android:maxLines="1"
+ android:layout_marginRight="8dp"
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content" />
+ </RelativeLayout>
+ <TextView
+ android:id="@+id/push_notification_style_1_content"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:textColor="@android:color/black"
+ android:layout_marginRight="4dp"
+ android:layout_marginTop="1dp"
+ android:textSize="13sp"
+ android:maxLines="2"
+ android:ellipsize="end" />
+ </LinearLayout>
+ </RelativeLayout>
+
+</RelativeLayout>
\ No newline at end of file
diff --git a/platforms/android/app/src/main/res/values-zh/jpush_string.xml b/platforms/android/app/src/main/res/values-zh/jpush_string.xml
new file mode 100755
index 0000000..069b6f4
--- /dev/null
+++ b/platforms/android/app/src/main/res/values-zh/jpush_string.xml
@@ -0,0 +1,7 @@
+<?xml version="1.0" encoding="utf-8"?>
+<resources>
+ <string name="jg_channel_name_p_min">不重要</string>
+ <string name="jg_channel_name_p_low">不重要</string>
+ <string name="jg_channel_name_p_default">普通</string>
+ <string name="jg_channel_name_p_high">重要</string>
+</resources>
\ No newline at end of file
diff --git a/platforms/android/app/src/main/res/values/jpush_string.xml b/platforms/android/app/src/main/res/values/jpush_string.xml
new file mode 100755
index 0000000..70a4ea7
--- /dev/null
+++ b/platforms/android/app/src/main/res/values/jpush_string.xml
@@ -0,0 +1,8 @@
+<?xml version="1.0" encoding="utf-8"?>
+<resources>
+ <string name="jg_channel_name_p_min">LOW</string>
+ <string name="jg_channel_name_p_low">LOW</string>
+ <string name="jg_channel_name_p_default">NORMAL</string>
+ <string name="jg_channel_name_p_high">HIGH</string>
+
+</resources>
\ No newline at end of file
diff --git a/platforms/android/app/src/main/res/values/jpush_style.xml b/platforms/android/app/src/main/res/values/jpush_style.xml
new file mode 100755
index 0000000..81dfdbb
--- /dev/null
+++ b/platforms/android/app/src/main/res/values/jpush_style.xml
@@ -0,0 +1,13 @@
+<?xml version="1.0" encoding="utf-8"?>
+<resources xmlns:android="http://schemas.android.com/apk/res/android">
+ <style name="MyDialogStyle">
+ <item name="android:windowBackground">@android:color/transparent</item>
+ <item name="android:windowFrame">@null</item>
+ <item name="android:windowNoTitle">true</item>
+ <item name="android:windowIsFloating">true</item>
+ <item name="android:windowIsTranslucent">true</item>
+ <item name="android:windowContentOverlay">@null</item>
+ <item name="android:windowAnimationStyle">@android:style/Animation.Dialog</item>
+ <item name="android:backgroundDimEnabled">true</item>
+ </style>
+</resources>
\ No newline at end of file
diff --git a/platforms/android/app/src/main/res/xml/config.xml b/platforms/android/app/src/main/res/xml/config.xml
index e81ee23..a0b93ed 100644
--- a/platforms/android/app/src/main/res/xml/config.xml
+++ b/platforms/android/app/src/main/res/xml/config.xml
@@ -34,6 +34,9 @@
<feature name="ThemeableBrowser">
<param name="android-package" value="com.initialxy.cordova.themeablebrowser.ThemeableBrowser" />
</feature>
+ <feature name="JPushPlugin">
+ <param name="android-package" value="cn.jiguang.cordova.push.JPushPlugin" />
+ </feature>
<name short="大理市民卡">dlapp</name>
<description>
A sample Apache Cordova application that responds to the deviceready event.
@@ -60,6 +63,7 @@
<preference name="loglevel" value="DEBUG" />
<preference name="AutoHideSplashScreen" value="true" />
<preference name="SplashScreenDelay" value="0" />
+ <preference name="SplashShowOnlyFirstTime" value="true" />
<preference name="ErrorUrl" value="error.html" />
<preference name="Orientation" value="portrait" />
<preference name="UseSwiftLanguageVersion" value="4.0" />
diff --git a/platforms/android/build.gradle b/platforms/android/build.gradle
index bea8a74..a3473f2 100644
--- a/platforms/android/build.gradle
+++ b/platforms/android/build.gradle
@@ -29,6 +29,8 @@
// in the individual module build.gradle files
classpath 'com.android.tools.build:gradle:3.3.0'
+
+
}
}
diff --git a/platforms/android/platform_www/cordova_plugins.js b/platforms/android/platform_www/cordova_plugins.js
index 049ccd6..595ecb1 100644
--- a/platforms/android/platform_www/cordova_plugins.js
+++ b/platforms/android/platform_www/cordova_plugins.js
@@ -319,6 +319,14 @@
"clobbers": [
"cordova.ThemeableBrowser"
]
+ },
+ {
+ "id": "jpush-phonegap-plugin.JPushPlugin",
+ "file": "plugins/jpush-phonegap-plugin/www/JPushPlugin.js",
+ "pluginId": "jpush-phonegap-plugin",
+ "clobbers": [
+ "JPush"
+ ]
}
];
module.exports.metadata = {
@@ -334,6 +342,8 @@
"cordova-plugin-camera": "4.0.3",
"cordova-plugin-inappbrowser": "3.0.0",
"cordova-plugin-device": "2.0.2",
- "cordova-plugin-themeablebrowser": "0.2.17"
+ "cordova-plugin-themeablebrowser": "0.2.17",
+ "cordova-plugin-jcore": "1.3.0",
+ "jpush-phonegap-plugin": "3.7.2"
};
});
\ No newline at end of file
diff --git a/platforms/android/platform_www/plugins/cordova-plugin-firebasex/www/firebase.js b/platforms/android/platform_www/plugins/cordova-plugin-firebasex/www/firebase.js
new file mode 100644
index 0000000..4dd1f7e
--- /dev/null
+++ b/platforms/android/platform_www/plugins/cordova-plugin-firebasex/www/firebase.js
@@ -0,0 +1,187 @@
+cordova.define("cordova-plugin-firebasex.FirebasePlugin", function(require, exports, module) {
+var exec = require('cordova/exec');
+
+exports.getVerificationID = function (number, success, error) {
+ exec(success, error, "FirebasePlugin", "getVerificationID", [number]);
+};
+
+exports.getId = function (success, error) {
+ exec(success, error, "FirebasePlugin", "getId", []);
+};
+
+exports.getToken = function (success, error) {
+ exec(success, error, "FirebasePlugin", "getToken", []);
+};
+
+exports.onMessageReceived = function (success, error) {
+ exec(success, error, "FirebasePlugin", "onMessageReceived", []);
+};
+
+exports.onTokenRefresh = function (success, error) {
+ exec(success, error, "FirebasePlugin", "onTokenRefresh", []);
+};
+
+exports.setBadgeNumber = function (number, success, error) {
+ exec(success, error, "FirebasePlugin", "setBadgeNumber", [number]);
+};
+
+exports.getBadgeNumber = function (success, error) {
+ exec(success, error, "FirebasePlugin", "getBadgeNumber", []);
+};
+
+exports.subscribe = function (topic, success, error) {
+ exec(success, error, "FirebasePlugin", "subscribe", [topic]);
+};
+
+exports.unsubscribe = function (topic, success, error) {
+ exec(success, error, "FirebasePlugin", "unsubscribe", [topic]);
+};
+
+exports.unregister = function (success, error) {
+ exec(success, error, "FirebasePlugin", "unregister", []);
+};
+
+exports.logEvent = function (name, params, success, error) {
+ exec(success, error, "FirebasePlugin", "logEvent", [name, params]);
+};
+
+
+
+exports.setScreenName = function (name, success, error) {
+ exec(success, error, "FirebasePlugin", "setScreenName", [name]);
+};
+
+exports.setUserId = function (id, success, error) {
+ exec(success, error, "FirebasePlugin", "setUserId", [id]);
+};
+
+exports.setUserProperty = function (name, value, success, error) {
+ exec(success, error, "FirebasePlugin", "setUserProperty", [name, value]);
+};
+
+exports.activateFetched = function (success, error) {
+ exec(success, error, "FirebasePlugin", "activateFetched", []);
+};
+
+exports.fetch = function (cacheExpirationSeconds, success, error) {
+ var args = [];
+ if (typeof cacheExpirationSeconds === 'number') {
+ args.push(cacheExpirationSeconds);
+ } else {
+ error = success;
+ success = cacheExpirationSeconds;
+ }
+ exec(success, error, "FirebasePlugin", "fetch", args);
+};
+
+exports.getByteArray = function (key, success, error) {
+ exec(success, error, "FirebasePlugin", "getByteArray", [key]);
+};
+
+exports.getValue = function (key, success, error) {
+ exec(success, error, "FirebasePlugin", "getValue", [key]);
+};
+
+exports.getInfo = function (success, error) {
+ exec(success, error, "FirebasePlugin", "getInfo", []);
+};
+
+exports.setConfigSettings = function (settings, success, error) {
+ exec(success, error, "FirebasePlugin", "setConfigSettings", [settings]);
+};
+
+exports.setDefaults = function (defaults, success, error) {
+ exec(success, error, "FirebasePlugin", "setDefaults", [defaults]);
+};
+
+exports.startTrace = function (name, success, error) {
+ exec(success, error, "FirebasePlugin", "startTrace", [name]);
+};
+
+exports.incrementCounter = function (name, counterNamed, success, error) {
+ exec(success, error, "FirebasePlugin", "incrementCounter", [name, counterNamed]);
+};
+
+exports.stopTrace = function (name, success, error) {
+ exec(success, error, "FirebasePlugin", "stopTrace", [name]);
+};
+
+exports.setAnalyticsCollectionEnabled = function (enabled, success, error) {
+ exec(success, error, "FirebasePlugin", "setAnalyticsCollectionEnabled", [enabled]);
+};
+
+exports.setPerformanceCollectionEnabled = function (enabled, success, error) {
+ exec(success, error, "FirebasePlugin", "setPerformanceCollectionEnabled", [enabled]);
+};
+
+exports.verifyPhoneNumber = function (number, timeOutDuration, success, error) {
+ if (typeof timeOutDuration === 'function') {
+ // method being called with old signature: function(number, success, error)
+ // timeOutDuration is the success callback, success is the error callback
+ exec(timeOutDuration, success, "FirebasePlugin", "verifyPhoneNumber", [number]);
+ } else {
+ // method being called with new signature: function(number, timeOutDuration, success, error)
+ // callbacks are correctly named
+ exec(success, error, "FirebasePlugin", "verifyPhoneNumber", [number, timeOutDuration]);
+ }
+};
+
+exports.clearAllNotifications = function (success, error) {
+ exec(success, error, "FirebasePlugin", "clearAllNotifications", []);
+};
+
+
+// Crashlytics
+exports.logMessage = function (message, success, error) {
+ exec(success, error, "FirebasePlugin", "logMessage", [message]);
+};
+
+exports.sendCrash = function (success, error) {
+ exec(success, error, "FirebasePlugin", "sendCrash", []);
+};
+
+exports.logError = function (message, stackTrace, success, error) {
+ var args = [message];
+ // "stackTrace" is an optional arg that's an array of objects.
+ if (stackTrace) {
+ if (typeof stackTrace === 'function') {
+ error = success;
+ success = stackTrace;
+ } else {
+ args.push(stackTrace);
+ }
+ }
+ exec(success, error, "FirebasePlugin", "logError", args);
+};
+
+exports.setCrashlyticsUserId = function (userId, success, error) {
+ exec(success, error, "FirebasePlugin", "setCrashlyticsUserId", [userId]);
+};
+
+// iOS-only
+exports.grantPermission = function (success, error) {
+ exec(success, error, "FirebasePlugin", "grantPermission", []);
+};
+
+exports.hasPermission = function (success, error) {
+ exec(success, error, "FirebasePlugin", "hasPermission", []);
+};
+
+// Android-only
+exports.setDefaultChannel = function (options, success, error) {
+ exec(success, error, "FirebasePlugin", "setDefaultChannel", [options]);
+};
+
+exports.createChannel = function (options, success, error) {
+ exec(success, error, "FirebasePlugin", "createChannel", [options]);
+};
+
+exports.deleteChannel = function (channelID, success, error) {
+ exec(success, error, "FirebasePlugin", "deleteChannel", [channelID]);
+};
+
+exports.listChannels = function (success, error) {
+ exec(success, error, "FirebasePlugin", "listChannels", []);
+};
+
+});
diff --git a/platforms/android/platform_www/plugins/jpush-phonegap-plugin/www/JPushPlugin.js b/platforms/android/platform_www/plugins/jpush-phonegap-plugin/www/JPushPlugin.js
new file mode 100644
index 0000000..773b885
--- /dev/null
+++ b/platforms/android/platform_www/plugins/jpush-phonegap-plugin/www/JPushPlugin.js
@@ -0,0 +1,489 @@
+cordova.define("jpush-phonegap-plugin.JPushPlugin", function(require, exports, module) {
+var JPushPlugin = function() {};
+
+// private plugin function
+
+JPushPlugin.prototype.receiveMessage = {};
+JPushPlugin.prototype.openNotification = {};
+JPushPlugin.prototype.receiveNotification = {};
+
+JPushPlugin.prototype.isPlatformIOS = function() {
+ return (
+ device.platform === "iPhone" ||
+ device.platform === "iPad" ||
+ device.platform === "iPod touch" ||
+ device.platform === "iOS"
+ );
+};
+
+JPushPlugin.prototype.errorCallback = function(msg) {
+ console.log("JPush Callback Error: " + msg);
+};
+
+JPushPlugin.prototype.callNative = function(
+ name,
+ args,
+ successCallback,
+ errorCallback
+) {
+ if (errorCallback) {
+ cordova.exec(successCallback, errorCallback, "JPushPlugin", name, args);
+ } else {
+ cordova.exec(
+ successCallback,
+ this.errorCallback,
+ "JPushPlugin",
+ name,
+ args
+ );
+ }
+};
+
+// Common methods
+JPushPlugin.prototype.init = function() {
+ if (this.isPlatformIOS()) {
+ this.callNative("initial", [], null);
+ } else {
+ this.callNative("init", [], null);
+ }
+};
+
+JPushPlugin.prototype.setDebugMode = function(mode) {
+ if (device.platform === "Android") {
+ this.callNative("setDebugMode", [mode], null);
+ } else {
+ if (mode === true) {
+ this.setDebugModeFromIos();
+ } else {
+ this.setLogOFF();
+ }
+ }
+};
+
+JPushPlugin.prototype.getRegistrationID = function(successCallback) {
+ this.callNative("getRegistrationID", [], successCallback);
+};
+
+JPushPlugin.prototype.stopPush = function() {
+ this.callNative("stopPush", [], null);
+};
+
+JPushPlugin.prototype.resumePush = function() {
+ this.callNative("resumePush", [], null);
+};
+
+JPushPlugin.prototype.isPushStopped = function(successCallback) {
+ this.callNative("isPushStopped", [], successCallback);
+};
+
+JPushPlugin.prototype.clearLocalNotifications = function() {
+ if (device.platform === "Android") {
+ this.callNative("clearLocalNotifications", [], null);
+ } else {
+ this.clearAllLocalNotifications();
+ }
+};
+
+/**
+ * 设置标签。
+ * 注意:该接口是覆盖逻辑,而不是增量逻辑。即新的调用会覆盖之前的设置。
+ *
+ * @param params = { 'sequence': number, 'tags': ['tag1', 'tag2'] }
+ */
+JPushPlugin.prototype.setTags = function(
+ params,
+ successCallback,
+ errorCallback
+) {
+ this.callNative("setTags", [params], successCallback, errorCallback);
+};
+
+/**
+ * 新增标签。
+ *
+ * @param params = { 'sequence': number, 'tags': ['tag1', 'tag2'] }
+ */
+JPushPlugin.prototype.addTags = function(
+ params,
+ successCallback,
+ errorCallback
+) {
+ this.callNative("addTags", [params], successCallback, errorCallback);
+};
+
+/**
+ * 删除指定标签。
+ *
+ * @param params = { 'sequence': number, 'tags': ['tag1', 'tag2'] }
+ */
+JPushPlugin.prototype.deleteTags = function(
+ params,
+ successCallback,
+ errorCallback
+) {
+ this.callNative("deleteTags", [params], successCallback, errorCallback);
+};
+
+/**
+ * 清除所有标签。
+ *
+ * @param params = { 'sequence': number }
+ */
+JPushPlugin.prototype.cleanTags = function(
+ params,
+ successCallback,
+ errorCallback
+) {
+ this.callNative("cleanTags", [params], successCallback, errorCallback);
+};
+
+/**
+ * 查询所有标签。
+ *
+ * @param params = { 'sequence': number }
+ */
+JPushPlugin.prototype.getAllTags = function(
+ params,
+ successCallback,
+ errorCallback
+) {
+ this.callNative("getAllTags", [params], successCallback, errorCallback);
+};
+
+/**
+ * 查询指定标签与当前用户的绑定状态。
+ *
+ * @param params = { 'sequence': number, 'tag': string }
+ */
+JPushPlugin.prototype.checkTagBindState = function(
+ params,
+ successCallback,
+ errorCallback
+) {
+ this.callNative(
+ "checkTagBindState",
+ [params],
+ successCallback,
+ errorCallback
+ );
+};
+
+/**
+ * 设置别名。
+ * 注意:该接口是覆盖逻辑,而不是增量逻辑。即新的调用会覆盖之前的设置。
+ *
+ * @param params = { 'sequence': number, 'alias': string }
+ */
+JPushPlugin.prototype.setAlias = function(
+ params,
+ successCallback,
+ errorCallback
+) {
+ this.callNative("setAlias", [params], successCallback, errorCallback);
+};
+
+/**
+ * 删除别名。
+ *
+ * @param params = { 'sequence': number }
+ */
+JPushPlugin.prototype.deleteAlias = function(
+ params,
+ successCallback,
+ errorCallback
+) {
+ this.callNative("deleteAlias", [params], successCallback, errorCallback);
+};
+
+/**
+ * 查询当前绑定的别名。
+ *
+ * @param params = { 'sequence': number }
+ */
+JPushPlugin.prototype.getAlias = function(
+ params,
+ successCallback,
+ errorCallback
+) {
+ this.callNative("getAlias", [params], successCallback, errorCallback);
+};
+
+// 判断系统设置中是否对本应用启用通知。
+// iOS: 返回值如果大于 0,代表通知开启;0: 通知关闭。
+// UIRemoteNotificationTypeNone = 0,
+// UIRemoteNotificationTypeBadge = 1 << 0,
+// UIRemoteNotificationTypeSound = 1 << 1,
+// UIRemoteNotificationTypeAlert = 1 << 2,
+// UIRemoteNotificationTypeNewsstandContentAvailability = 1 << 3,
+// Android: 返回值 1 代表通知启用;0: 通知关闭。
+JPushPlugin.prototype.getUserNotificationSettings = function(successCallback) {
+ if (this.isPlatformIOS()) {
+ this.callNative("getUserNotificationSettings", [], successCallback);
+ } else if (device.platform === "Android") {
+ this.callNative("areNotificationEnabled", [], successCallback);
+ }
+};
+
+// iOS methods
+
+JPushPlugin.prototype.startJPushSDK = function() {
+ this.callNative("startJPushSDK", [], null);
+};
+
+JPushPlugin.prototype.setBadge = function(value) {
+ if (this.isPlatformIOS()) {
+ this.callNative("setBadge", [value], null);
+ }
+};
+
+JPushPlugin.prototype.resetBadge = function() {
+ if (this.isPlatformIOS()) {
+ this.callNative("resetBadge", [], null);
+ }
+};
+
+JPushPlugin.prototype.setDebugModeFromIos = function() {
+ if (this.isPlatformIOS()) {
+ this.callNative("setDebugModeFromIos", [], null);
+ }
+};
+
+JPushPlugin.prototype.setLogOFF = function() {
+ if (this.isPlatformIOS()) {
+ this.callNative("setLogOFF", [], null);
+ }
+};
+
+JPushPlugin.prototype.setCrashLogON = function() {
+ if (this.isPlatformIOS()) {
+ this.callNative("crashLogON", [], null);
+ }
+};
+
+JPushPlugin.prototype.addLocalNotificationForIOS = function(
+ delayTime,
+ content,
+ badge,
+ notificationID,
+ extras
+) {
+ if (this.isPlatformIOS()) {
+ this.callNative(
+ "setLocalNotification",
+ [delayTime, content, badge, notificationID, extras],
+ null
+ );
+ }
+};
+
+JPushPlugin.prototype.deleteLocalNotificationWithIdentifierKeyInIOS = function(
+ identifierKey
+) {
+ if (this.isPlatformIOS()) {
+ this.callNative(
+ "deleteLocalNotificationWithIdentifierKey",
+ [identifierKey],
+ null
+ );
+ }
+};
+
+JPushPlugin.prototype.clearAllLocalNotifications = function() {
+ if (this.isPlatformIOS()) {
+ this.callNative("clearAllLocalNotifications", [], null);
+ }
+};
+
+JPushPlugin.prototype.setLocation = function(latitude, longitude) {
+ if (this.isPlatformIOS()) {
+ this.callNative("setLocation", [latitude, longitude], null);
+ }
+};
+
+JPushPlugin.prototype.startLogPageView = function(pageName) {
+ if (this.isPlatformIOS()) {
+ this.callNative("startLogPageView", [pageName], null);
+ }
+};
+
+JPushPlugin.prototype.stopLogPageView = function(pageName) {
+ if (this.isPlatformIOS()) {
+ this.callNative("stopLogPageView", [pageName], null);
+ }
+};
+
+JPushPlugin.prototype.beginLogPageView = function(pageName, duration) {
+ if (this.isPlatformIOS()) {
+ this.callNative("beginLogPageView", [pageName, duration], null);
+ }
+};
+
+JPushPlugin.prototype.setApplicationIconBadgeNumber = function(badge) {
+ if (this.isPlatformIOS()) {
+ this.callNative("setApplicationIconBadgeNumber", [badge], null);
+ }
+};
+
+JPushPlugin.prototype.getApplicationIconBadgeNumber = function(callback) {
+ if (this.isPlatformIOS()) {
+ this.callNative("getApplicationIconBadgeNumber", [], callback);
+ }
+};
+
+JPushPlugin.prototype.addDismissActions = function(actions, categoryId) {
+ this.callNative("addDismissActions", [actions, categoryId]);
+};
+
+JPushPlugin.prototype.addNotificationActions = function(actions, categoryId) {
+ this.callNative("addNotificationActions", [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);
+ }
+};
+
+JPushPlugin.prototype.setCustomPushNotificationBuilder = function() {
+ if (device.platform === "Android") {
+ this.callNative("setCustomPushNotificationBuilder", [], null);
+ }
+};
+
+JPushPlugin.prototype.receiveRegistrationIdInAndroidCallback = function(data) {
+ if (device.platform === "Android") {
+ data = JSON.stringify(data);
+ var event = JSON.parse(data);
+ cordova.fireDocumentEvent("jpush.receiveRegistrationId", event);
+ }
+};
+
+JPushPlugin.prototype.receiveMessageInAndroidCallback = function(data) {
+ data = JSON.stringify(data);
+ this.receiveMessage = JSON.parse(data);
+ cordova.fireDocumentEvent("jpush.receiveMessage", this.receiveMessage);
+};
+
+JPushPlugin.prototype.openNotificationInAndroidCallback = function(data) {
+ data = JSON.stringify(data);
+ this.openNotification = JSON.parse(data);
+ cordova.fireDocumentEvent("jpush.openNotification", this.openNotification);
+};
+
+JPushPlugin.prototype.receiveNotificationInAndroidCallback = function(data) {
+ data = JSON.stringify(data);
+ this.receiveNotification = JSON.parse(data);
+ cordova.fireDocumentEvent(
+ "jpush.receiveNotification",
+ this.receiveNotification
+ );
+};
+
+JPushPlugin.prototype.clearAllNotification = function() {
+ if (device.platform === "Android") {
+ this.callNative("clearAllNotification", [], null);
+ }
+};
+
+JPushPlugin.prototype.clearNotificationById = function(id) {
+ if (device.platform === "Android") {
+ this.callNative("clearNotificationById", [id], null);
+ }
+};
+
+JPushPlugin.prototype.setLatestNotificationNum = function(num) {
+ if (device.platform === "Android") {
+ this.callNative("setLatestNotificationNum", [num], null);
+ }
+};
+
+JPushPlugin.prototype.addLocalNotification = function(
+ builderId,
+ content,
+ title,
+ notificationID,
+ broadcastTime,
+ extras
+) {
+ if (device.platform === "Android") {
+ this.callNative(
+ "addLocalNotification",
+ [builderId, content, title, notificationID, broadcastTime, extras],
+ null
+ );
+ }
+};
+
+JPushPlugin.prototype.removeLocalNotification = function(notificationID) {
+ if (device.platform === "Android") {
+ this.callNative("removeLocalNotification", [notificationID], null);
+ }
+};
+
+JPushPlugin.prototype.reportNotificationOpened = function(msgID) {
+ if (device.platform === "Android") {
+ this.callNative("reportNotificationOpened", [msgID], null);
+ }
+};
+
+/**
+ * 用于在 Android 6.0 及以上系统,申请一些权限
+ * 具体可看:http://docs.jpush.io/client/android_api/#android-60
+ */
+JPushPlugin.prototype.requestPermission = function() {
+ if (device.platform === "Android") {
+ this.callNative("requestPermission", [], null);
+ }
+};
+
+JPushPlugin.prototype.setSilenceTime = function(
+ startHour,
+ startMinute,
+ endHour,
+ endMinute
+) {
+ if (device.platform === "Android") {
+ this.callNative(
+ "setSilenceTime",
+ [startHour, startMinute, endHour, endMinute],
+ null
+ );
+ }
+};
+
+JPushPlugin.prototype.setPushTime = function(weekdays, startHour, endHour) {
+ if (device.platform === "Android") {
+ this.callNative("setPushTime", [weekdays, startHour, endHour], null);
+ }
+};
+
+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 = {};
+}
+
+if (!window.plugins.jPushPlugin) {
+ window.plugins.jPushPlugin = new JPushPlugin();
+}
+
+module.exports = new JPushPlugin();
+
+});
diff --git a/platforms/android/project.properties b/platforms/android/project.properties
index 661238d..8a65caa 100644
--- a/platforms/android/project.properties
+++ b/platforms/android/project.properties
@@ -13,4 +13,4 @@
android.library.reference.2=app
cordova.system.library.1=com.squareup.okhttp3:okhttp-urlconnection:3.10.0
cordova.gradle.include.1=cordova-plugin-qrscanner/dlapp-qrscanner.gradle
-cordova.system.library.2=com.android.support:support-v4:24.1.1+
\ No newline at end of file
+cordova.system.library.2=com.android.support:support-v4:24.1.1+