How to send activity to Firebase Message value or call activity?

431 views Asked by At
@Override
public void onMessageReceived(RemoteMessage remoteMessage) {

    String message = remoteMessage.getData().get("message");

    Intent intent = new Intent(this, MainActivity.class);
    intent.putExtra("message", message);
    intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP | Intent.FLAG_ACTIVITY_NEW_TASK);
    startActivity(intent);
}
1

There are 1 answers

3
ρяσѕρєя K On

How to send activity to Firebase Message value or call activity?

FirebaseMessagingService extends Service class , use class Context in which extending FirebaseMessagingService service class as first parameter to Intent constructor.

Intent intent = new Intent(CurrentClassName.this, MainActivity.class);