Update Android SDK to v3.1.1 & Update MyReceiver to JPushReceiver

This commit is contained in:
Hevin
2018-01-27 09:41:35 +08:00
parent 261eb44473
commit 1954d6b55b
4 changed files with 11 additions and 25 deletions
@@ -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.
Binary file not shown.