[英]Android Grouped Notification (from OneSignal) crashes app when trying to open
Clicking on single notifications from OneSignal opens my app without issues, but if I have a grouped notification, it attempts to open the app and then closes it without much error. 单击OneSignal中的单个通知可以打开我的应用程序,而不会出现问题,但是如果我有分组的通知,它将尝试打开该应用程序,然后关闭它而没有太多错误。 The only thing I can really see of relevance in my output logs is there are multiple "Activity_launch_request", one for each notification in the group, as soon as I click the grouped notification. 我真正能看到的与输出日志相关的唯一一件事就是,有多个“ Activity_launch_request”,只要单击分组的通知,该组中的每个通知就一个。 (My device is a Xiaomi Mi Max, that tag may just be specific to this device) (我的设备是Xiaomi Mi Max,该标签可能仅适用于此设备)
Relevant notification click handling code: 相关通知点击处理代码:
@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();
}
}
Note that even though "Activity_launch_request" gets fired "group_count" times, "notificationOpened" only gets printed once, so it's safe to say my launch intent only gets fired once. 请注意,即使“ Activity_launch_request”被触发了“ group_count”次,“ notificationOpened”也仅被打印了一次,因此可以肯定地说我的启动意图仅被触发了一次。
My activity launchMode is "singleTop". 我的活动launchMode是“ singleTop”。
Can someone please help me fix this issue? 有人可以帮我解决这个问题吗?
事实证明这是一个有效载荷和AndroidManifest问题,我们的网站网址位于有效载荷中,而我的AndroidManifest具有一个意图过滤器,用于从我们的网址启动该应用程序。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.