【问题标题】:Android Grouped Notification (from OneSignal) crashes app when trying to openAndroid 分组通知(来自 OneSignal)在尝试打开时崩溃应用程序
【发布时间】: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


    【解决方案1】:

    这原来是一个有效负载和 AndroidManifest 问题,我们的网站 url 在有效负载中,我的 AndroidManifest 有一个意图过滤器来从我们的 url 启动应用程序。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2023-04-04
      • 2022-10-19
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2011-08-08
      • 1970-01-01
      • 2018-03-12
      相关资源
      最近更新 更多