Compare commits

...

7 Commits

Author SHA1 Message Date
huangminlinux
83b7ca162a update to 3.3.1 2018-01-31 16:19:17 +08:00
huangminlinux
7f2179fe32 fix backgroup notification event fire twice 2018-01-31 16:12:31 +08:00
Hevin
4f0c186bc3 build: v3.3.0 2018-01-27 09:54:21 +08:00
Hevin
1954d6b55b Update Android SDK to v3.1.1 & Update MyReceiver to JPushReceiver 2018-01-27 09:41:35 +08:00
Hevin
261eb44473 Add comment about cordova-android 7.0.0 2018-01-17 15:18:17 +08:00
huangminlinux
504fbb0789 add issue template 2017-12-26 10:37:09 +08:00
Hevin
cbacc7cb83 Add explain of APP_KEY 2017-12-20 13:22:08 +08:00
8 changed files with 61 additions and 30 deletions

View File

@@ -1,7 +1,7 @@
# 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)
[![release](https://img.shields.io/badge/release-3.2.13-blue.svg)](https://github.com/jpush/jpush-phonegap-plugin/releases)
[![release](https://img.shields.io/badge/release-3.3.0-blue.svg)](https://github.com/jpush/jpush-phonegap-plugin/releases)
[![platforms](https://img.shields.io/badge/platforms-iOS%7CAndroid-lightgrey.svg)](https://github.com/jpush/jpush-phonegap-plugin)
[![weibo](https://img.shields.io/badge/weibo-JPush-blue.svg)](http://weibo.com/jpush?refer_flag=1001030101_&is_all=1)
@@ -11,8 +11,15 @@
- 如需要短信验证码功能插件,可关注 [cordova-plugin-jsms](https://github.com/jpush/cordova-plugin-jsms)
- 如需要统计分析功能插件,可关注 [cordova-plugin-janalytics](https://github.com/jpush/cordova-plugin-janalytics)
注意:目前插件暂未支持 cordova-android 7.0.0,因此在添加 android platform 时,请指定 7.0.0 以下版本,例如 6.4.0。
## Install
> 注意:
>
> - 应用的包名一定要和 APP_KEY 对应应用的包名一致,否则极光推送服务无法注册成功。
> - 在使用 8 或以上版本的 Xcode 调试 iOS 项目时,需要先在项目配置界面的 Capabilities 中打开 Push Notifications 开关。
- 通过 Cordova Plugins 安装,要求 Cordova CLI 5.0+
```shell
@@ -53,7 +60,6 @@ import { JPush } from '@jiguang-ionic/jpush';
具体可参考 ./ionic/example 中的文件。
> 在使用 Xcode 8 或以上调试 iOS 项目时,需要先在项目配置界面的 Capabilities 中打开 Push Notifications 开关。
## Usage

35
issue_template.md Normal file
View File

@@ -0,0 +1,35 @@
**WARNING: 如果不按照这个表格,我们将无法帮助你,并将忽略你的问题。**
## 你的运行环境
* 插件版本:
* 平台Android / iOS:
* Cordova version (```cordova -v```):
* Cordova platform version (```cordova platform ls```):
* Ionic Version (if using Ionic)
## 期望效果
告诉我们你希望达到什么效果。
## 实际效果
告诉我们实际是什么效果。
## 重现步骤
1. ...
2. ...
3. ...
4. ...
## 背景
你尝试做过些什么?
## Debug logs
包括 Android 或 iOS 的日志:
* iOS: XCode logs
* Android: $ adb logcat / Android Studio logcat

View File

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

View File

@@ -2,7 +2,7 @@
<plugin xmlns="http://apache.org/cordova/ns/plugins/1.0"
xmlns:android="http://schemas.android.com/apk/res/android"
id="jpush-phonegap-plugin"
version="3.2.13">
version="3.3.0">
<name>JPush</name>
<description>JPush for cordova plugin</description>
@@ -161,25 +161,14 @@
<!-- User defined. For test only 用户自定义的广播接收器 -->
<receiver
android:name="cn.jiguang.cordova.push.MyReceiver"
android:name="cn.jiguang.cordova.push.JPushReceiver"
android:enabled="true">
<intent-filter android:priority="1000">
<action android:name="cn.jpush.android.intent.NOTIFICATION_RECEIVED_PROXY" />
<!-- Required 显示通知栏 -->
<category android:name="$PACKAGE_NAME" />
</intent-filter>
<intent-filter>
<action android:name="cn.jpush.android.intent.REGISTRATION" />
<!-- Required 用户注册SDK的intent -->
<action android:name="cn.jpush.android.intent.UNREGISTRATION" />
<action android:name="cn.jpush.android.intent.MESSAGE_RECEIVED" />
<!-- Required 用户接收SDK消息的intent -->
<action android:name="cn.jpush.android.intent.NOTIFICATION_RECEIVED" />
<!-- Required 用户接收SDK通知栏信息的intent -->
<action android:name="cn.jpush.android.intent.NOTIFICATION_OPENED" />
<!-- Required 用户打开自定义通知栏的intent -->
<action android:name="cn.jpush.android.intent.ACTION_RICHPUSH_CALLBACK" />
<!-- Optional 用户接受Rich Push Javascript 回调函数的intent -->
<action android:name="cn.jpush.android.intent.CONNECTION" />
<category android:name="$PACKAGE_NAME" />
</intent-filter>
</receiver>
@@ -198,7 +187,7 @@
<receiver android:name="cn.jiguang.cordova.push.JPushEventReceiver">
<intent-filter>
<action android:name="cn.jpush.android.intent.RECEIVE_MESSAGE" />
<category android:name="$PACKAGE_NAME"></category>
<category android:name="$PACKAGE_NAME" />
</intent-filter>
</receiver>
@@ -207,9 +196,9 @@
<meta-data android:name="JPUSH_APPKEY" android:value="$APP_KEY" />
</config-file>
<source-file src="src/android/libs/jpush-android-3.1.0.jar" target-dir="libs" />
<source-file src="src/android/libs/jpush-android-3.1.1.jar" target-dir="libs" />
<source-file src="src/android/MyReceiver.java" target-dir="src/cn/jiguang/cordova/push" />
<source-file src="src/android/JPushReceiver.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/JPushEventReceiver.java" target-dir="src/cn/jiguang/cordova/push" />

View File

@@ -11,7 +11,7 @@ import java.util.Map;
import cn.jpush.android.api.JPushInterface;
public class MyReceiver extends BroadcastReceiver {
public class JPushReceiver extends BroadcastReceiver {
private static final List<String> IGNORED_EXTRAS_KEYS =
Arrays.asList(
@@ -56,17 +56,14 @@ public class MyReceiver extends BroadcastReceiver {
Intent launch = context.getPackageManager().getLaunchIntentForPackage(
context.getPackageName());
launch.addCategory(Intent.CATEGORY_LAUNCHER);
launch.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_SINGLE_TOP);
context.startActivity(launch);
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) {
Intent launch = context.getPackageManager().getLaunchIntentForPackage(
context.getPackageName());
launch.addCategory(Intent.CATEGORY_LAUNCHER);
launch.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_SINGLE_TOP);
String title = intent.getStringExtra(JPushInterface.EXTRA_NOTIFICATION_TITLE);
JPushPlugin.notificationTitle = title;

Binary file not shown.

View File

@@ -156,7 +156,7 @@ NSDictionary *_launchOptions;
}
-(void)jpushNotificationCenter:(UNUserNotificationCenter *)center willPresentNotification:(UNNotification *)notification withCompletionHandler:(void (^)(NSInteger))completionHandler{
NSMutableDictionary *userInfo = @[].mutableCopy;
NSMutableDictionary *userInfo = @{}.mutableCopy;
if ([notification.request.trigger isKindOfClass:[UNPushNotificationTrigger class]]) {
userInfo = [self jpushFormatAPNSDic:notification.request.content.userInfo];
@@ -169,6 +169,10 @@ NSDictionary *_launchOptions;
userInfo[@"identifier"] = notification.request.identifier;
}
if ([userInfo[@"aps"][@"content-available"] isEqualToNumber:@(1)]) {// content-available
return;
}
[JPushPlugin fireDocumentEvent:JPushDocumentEvent_ReceiveNotification jsString:[userInfo toJsonString]];
completionHandler(UNNotificationPresentationOptionBadge|UNNotificationPresentationOptionSound|UNNotificationPresentationOptionAlert);
}