小编Arm*_*yaz的帖子

在FCM中单击通知时打开特定活动

我在App上工作,我需要在其中显示通知.对于通知,我正在使用FireBase云消息传递(FCM).当app在后台时,我能够获得通知.

但是当我点击通知时,它会重定向到home.java页面.我希望它重定向到Notification.java页面.

所以,请告诉我如何在点击通知中指定活动.我使用两种服务:

1.)MyFirebaseMessagingService

2.)MyFirebaseInstanceIDService

这是我在MyFirebaseMessagingService类中的onMessageReceived()方法的代码示例.

public class MyFirebaseMessagingService extends FirebaseMessagingService {

private static final String TAG = "FirebaseMessageService";
Bitmap bitmap;


public void onMessageReceived(RemoteMessage remoteMessage) {



    Log.d(TAG, "From: " + remoteMessage.getFrom());

    // Check if message contains a data payload.
    if (remoteMessage.getData().size() > 0) {
        Log.d(TAG, "Message data payload: " + remoteMessage.getData());
    }

    // Check if message contains a notification payload.
    if (remoteMessage.getNotification() != null) {
        Log.d(TAG, "Message Notification Body: " …
Run Code Online (Sandbox Code Playgroud)

android android-notifications firebase-cloud-messaging firebase-notifications

17
推荐指数
4
解决办法
3万
查看次数