Bildirimin içeriğini al
Fragment 'ya git işlemini gerçekleştir
Fragment Bye git işlemini gerçekleştir
click_action alanı yerine özel bir veri örnek, bir komut veya işlem adı taşıyan bir veri alanı ekleyebiliriz
@Override
public void onMessageReceived(RemoteMessage remoteMessage) {
String notificationMessage = remoteMessage.getNotification().getBody();
String customAction = remoteMessage.getData().get("customAction");
if ("goToFragmentA".equals(customAction)) {
performActionInFragmentA(notificationMessage);
} else if ("goToFragmentB".equals(customAction)) {
performActionInFragmentB(notificationMessage);
}
}
private void performActionInFragmentA(String message) {
FragmentA fragmentA = (FragmentA) getSupportFragmentManager().findFragmentByTag("fragmentA");
if (fragmentA != null) {
fragmentA.doSomethingWithMessage(message);
}
}
private void performActionInFragmentB(String message) {
FragmentB fragmentB = (FragmentB) getSupportFragmentManager().findFragmentByTag("fragmentB");
if (fragmentB != null) {
fragmentB.doSomethingWithMessage(message);
}
}Olabilirmi ?