1

我尝试使用 Pinpoint 向我的应用程序添加推送通知功能,但我遇到了一个问题:推送通知正在显示,但当我单击它时没有任何操作。我收到有关服务的通知。我像这样构建我的通知:

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

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

notifClient.handleCampaignPush(notifDetail)

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

有人有想法吗?

谢谢 !

4

2 回答 2

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>

这应该有效。

于 2018-05-17T14:18:41.693 回答
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

于 2018-07-17T17:57:57.223 回答