Skip to content Skip to sidebar Skip to footer

Open Fragment From Firebase Onmessagereceived

I'm trying to open a fragment when a new Notification is received. For this I use a BroadcastReceiver. Problem is I'm not getting the message in my Activity from sendNotification m

Solution 1:

If you want BroadcastReceiver to get the broadcast, you have to actually send the Broadcast. Put this code in your onMessageReceived():

Intentintent=newIntent("com.sam.CUSTOM_INTENT");
context.sendBroadcast(intent);

This snippet will send the broadcast to all registered BroadcastReceivers with IntentFilter matching action "com.sam.CUSTOM_INTENT".

So, with current implementation, your activity will get broadcast when it is resumed.

Post a Comment for "Open Fragment From Firebase Onmessagereceived"