Merge branch 'dev'

This commit is contained in:
Hevin 2017-12-04 13:32:54 +08:00
commit f6ece7dd1e
6 changed files with 9 additions and 12 deletions

View File

@ -1,7 +1,7 @@
# JPush PhoneGap / Cordova Plugin # JPush PhoneGap / Cordova Plugin
[![Build Status](https://travis-ci.org/jpush/jpush-phonegap-plugin.svg?branch=master)](https://travis-ci.org/jpush/jpush-phonegap-plugin) [![Build Status](https://travis-ci.org/jpush/jpush-phonegap-plugin.svg?branch=master)](https://travis-ci.org/jpush/jpush-phonegap-plugin)
[![release](https://img.shields.io/badge/release-3.2.12-blue.svg)](https://github.com/jpush/jpush-phonegap-plugin/releases) [![release](https://img.shields.io/badge/release-3.2.13-blue.svg)](https://github.com/jpush/jpush-phonegap-plugin/releases)
[![platforms](https://img.shields.io/badge/platforms-iOS%7CAndroid-lightgrey.svg)](https://github.com/jpush/jpush-phonegap-plugin) [![platforms](https://img.shields.io/badge/platforms-iOS%7CAndroid-lightgrey.svg)](https://github.com/jpush/jpush-phonegap-plugin)
[![weibo](https://img.shields.io/badge/weibo-JPush-blue.svg)](http://weibo.com/jpush?refer_flag=1001030101_&is_all=1) [![weibo](https://img.shields.io/badge/weibo-JPush-blue.svg)](http://weibo.com/jpush?refer_flag=1001030101_&is_all=1)
@ -72,14 +72,13 @@
Android 因为各 Rom 的高度定制化,不像 iOS 一样能有一个统一的管理,如果在 Android 中想自定义通知铃声,推荐通过 JPush 推送自定义 Android 因为各 Rom 的高度定制化,不像 iOS 一样能有一个统一的管理,如果在 Android 中想自定义通知铃声,推荐通过 JPush 推送自定义
消息,之后在 `jpush.receiveMessage` 事件监听中通过 [Cordova Local-Notification Plugin](https://github.com/katzer/cordova-plugin-local-notifications) 触发通知,再配合 [Cordova Background Plugin](https://github.com/katzer/cordova-plugin-background-mode) 插件保证应用的后台运行。 消息,之后在 `jpush.receiveMessage` 事件监听中通过 [Cordova Local-Notification Plugin](https://github.com/katzer/cordova-plugin-local-notifications) 触发通知,再配合 [Cordova Background Plugin](https://github.com/katzer/cordova-plugin-background-mode) 插件保证应用的后台运行。
#### 如果让通知内容像 iOS 一样换行展示? #### 如何让通知内容像 iOS 一样自动换行展示?
[#267](https://github.com/jpush/jpush-phonegap-plugin/issues/267) [#267](https://github.com/jpush/jpush-phonegap-plugin/issues/267)
#### 关闭 App 后收不到通知 #### 关闭 App 后收不到通知
Android 的推送通过长连接的方式实现,只有在连接保持的情况下才能收到通知。而有的第三方 ROM 会限制一般应用服务的自启动,也就是 Android 的推送通过长连接的方式实现,只有在保持连接的情况下才能收到通知。而有的第三方 ROM 会限制一般应用服务的自启动,也就是在退出应用后,应用的所有服务均被杀死,且无法自启动,所以就会收不到通知。
在退出应用后,应用的所有服务均被杀死,且无法自启动,所以就会收不到通知。
目前 JPush 是做了应用互相拉起机制的,也就是当用户打开其他集成了 JPush 的应用时,你的应用也能同时收到推送消息。 目前 JPush 是做了应用互相拉起机制的,也就是当用户打开其他集成了 JPush 的应用时,你的应用也能同时收到推送消息。

View File

@ -9,8 +9,8 @@
<script type="text/javascript" src="js/jquery.mobile-1.1.1.js"></script> <script type="text/javascript" src="js/jquery.mobile-1.1.1.js"></script>
<script type="text/javascript" src="cordova.js"></script> <script type="text/javascript" src="cordova.js"></script>
<script type="text/javascript"> <script type="text/javascript">
var onDeviceReady = function() {
var onDeviceReady = function() {
document.addEventListener("jpush.receiveRegistrationId", function (event) { document.addEventListener("jpush.receiveRegistrationId", function (event) {
alert("receiveRegistrationId" + JSON.stringify(event)); alert("receiveRegistrationId" + JSON.stringify(event));
$("#registrationId").html(event.registrationId); $("#registrationId").html(event.registrationId);
@ -94,13 +94,11 @@
var initiateUI = function() { var initiateUI = function() {
try { try {
window.JPush.init(); window.JPush.init();
window.setTimeout(getRegistrationID, 1000);
if (device.platform != "Android") {
window.JPush.setDebugModeFromIos();
window.JPush.setApplicationIconBadgeNumber(0);
} else {
window.JPush.setDebugMode(true); window.JPush.setDebugMode(true);
window.JPush.setStatisticsOpen(true); window.setTimeout(getRegistrationID, 1000);
if (device.platform != "Android") {
window.JPush.setApplicationIconBadgeNumber(0);
} }
} catch (exception) { } catch (exception) {
console.log(exception); console.log(exception);

View File

@ -1,6 +1,6 @@
{ {
"name": "jpush-phonegap-plugin", "name": "jpush-phonegap-plugin",
"version": "3.2.12", "version": "3.2.13",
"description": "JPush for cordova plugin", "description": "JPush for cordova plugin",
"cordova": { "cordova": {
"id": "jpush-phonegap-plugin", "id": "jpush-phonegap-plugin",

View File

@ -2,7 +2,7 @@
<plugin xmlns="http://apache.org/cordova/ns/plugins/1.0" <plugin xmlns="http://apache.org/cordova/ns/plugins/1.0"
xmlns:android="http://schemas.android.com/apk/res/android" xmlns:android="http://schemas.android.com/apk/res/android"
id="jpush-phonegap-plugin" id="jpush-phonegap-plugin"
version="3.2.12"> version="3.2.13">
<name>JPush</name> <name>JPush</name>
<description>JPush for cordova plugin</description> <description>JPush for cordova plugin</description>
@ -207,7 +207,7 @@
<meta-data android:name="JPUSH_APPKEY" android:value="$APP_KEY" /> <meta-data android:name="JPUSH_APPKEY" android:value="$APP_KEY" />
</config-file> </config-file>
<source-file src="src/android/libs/jpush-android-3.0.9.jar" target-dir="libs" /> <source-file src="src/android/libs/jpush-android-3.1.0.jar" target-dir="libs" />
<source-file src="src/android/MyReceiver.java" target-dir="src/cn/jiguang/cordova/push" /> <source-file src="src/android/MyReceiver.java" target-dir="src/cn/jiguang/cordova/push" />
<source-file src="src/android/JPushPlugin.java" target-dir="src/cn/jiguang/cordova/push" /> <source-file src="src/android/JPushPlugin.java" target-dir="src/cn/jiguang/cordova/push" />

Binary file not shown.