【发布时间】:2017-02-20 01:03:52
【问题描述】:
单击来自 OneSignal 的单个通知会毫无问题地打开我的应用程序,但如果我有一个分组通知,它会尝试打开应用程序,然后将其关闭而不会出现太多错误。在我的输出日志中我唯一能真正看到的相关性是有多个“Activity_launch_request”,当我单击分组通知时,组中的每个通知一个。 (我的设备是小米 Mi Max,那个标签可能只是这个设备特有的)
相关通知点击处理代码:
@Override
public void notificationOpened(OSNotificationOpenResult result) {
bug.out("notificationOpened");
OSNotificationAction.ActionType actionType = result.action.type;
JSONObject data = result.notification.payload.additionalData;
Intent intent = new Intent(AndroidLauncher.this, AndroidLauncher.class);
intent.setFlags(Intent.FLAG_ACTIVITY_REORDER_TO_FRONT | Intent.FLAG_ACTIVITY_CLEAR_TOP | Intent.FLAG_ACTIVITY_SINGLE_TOP);
PendingIntent contentIntent = PendingIntent.getActivity(AndroidLauncher.this, 0, intent, 0);
try {
contentIntent.send();
} catch (PendingIntent.CanceledException e) {
e.printStackTrace();
}
}
请注意,即使“Activity_launch_request”被触发了“group_count”次,“notificationOpened”也只会被打印一次,所以可以肯定地说我的启动意图只会被触发一次。
我的活动启动模式是“singleTop”。
有人可以帮我解决这个问题吗?
【问题讨论】:
标签: android push-notification onesignal