update doc & add some new features

支持安卓直接获得通知标题;
优化安卓获取附加字段的方法。
This commit is contained in:
Hevin
2016-04-09 18:06:11 +08:00
parent 1ff72e4df4
commit dfb883e24c
6 changed files with 63 additions and 27 deletions
+10 -3
View File
@@ -44,13 +44,16 @@ public class MyReceiver extends BroadcastReceiver {
private void handlingNotificationOpen(Context context, Intent intent) {
Log.i(TAG, "---------------- handlingNotificationOpen");
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.transmitOpen(alert, extras);
JPushPlugin.transmitOpen(title, alert, extras);
Intent launch = context.getPackageManager().getLaunchIntentForPackage(
context.getPackageName());
@@ -62,17 +65,21 @@ public class MyReceiver extends BroadcastReceiver {
private void handlingNotificationReceive(Context context, Intent intent) {
Log.i(TAG, "---------------- handlingNotificationReceive");
Intent launch = context.getPackageManager().getLaunchIntentForPackage(context.getPackageName());
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;
String alert = intent.getStringExtra(JPushInterface.EXTRA_ALERT);
JPushPlugin.notificationAlert = alert;
Map<String, Object> extras = getNotificationExtras(intent);
JPushPlugin.notificationExtras = extras;
JPushPlugin.transmitReceive(alert, extras);
JPushPlugin.transmitReceive(title, alert, extras);
}
private Map<String, Object> getNotificationExtras(Intent intent) {