aws精确推送通知点击不工作

时间:2018-05-07 14:10:35

标签: android notifications firebase-cloud-messaging push aws-pinpoint

我尝试使用Pinpoint向我的应用添加推送通知功能,但我有一个问题:推送通知正在显示但是当我点击它时没有动作。 我收到了有关服务的通知。我建立了这样的通知:

val notifDetail =  NotificationDetails.builder()
                .from(message.from)
                .mapData(data)
                .intentAction(NotificationClient.FCM_INTENT_ACTION)
                .build()

然后我使用handleCampaignPush来显示推送:

notifClient.handleCampaignPush(notifDetail)

我尝试在NotificationsDetails Builder上使用参数.intent,但没有结果:(

有人有想法吗?

谢谢!

2 个答案:

答案 0 :(得分:0)

尝试将此添加到您的清单文件中:

      <receiver
        android:name="com.amazonaws.mobileconnectors.pinpoint.targeting.notification.PinpointNotificationReceiver">
        <intent-filter>
            <action android:name="com.amazonaws.intent.baidu.NOTIFICATION_OPEN" />
        </intent-filter>
    </receiver>

这应该有用。

答案 1 :(得分:0)

您可能需要添加代码来处理以应对传入的推送通知。

private final BroadcastReceiver notificationReceiver = new BroadcastReceiver() {
    @Override
    public void onReceive(Context context, Intent intent) {
        Log.d(LOG_TAG, "Received notification from local broadcast. Display it in a dialog.");

        Bundle data = intent.getBundleExtra(PushListenerService.INTENT_SNS_NOTIFICATION_DATA);
        String message = PushListenerService.getMessage(data);

        new AlertDialog.Builder(MainActivity.this)
                .setTitle("Push notification")
                .setMessage(message)
                .setPositiveButton(android.R.string.ok, null)
                .show();
    }
};

https://docs.aws.amazon.com/aws-mobile/latest/developerguide/add-aws-mobile-push-notifications.html