I an using FCM
for sending a notification in my app and all work perfectly but when my app is in background then the notification is handle by android system notification tray
i want to handle my notification from myself i am sending this payload for send the notification
$fields = array(
'notification' => $notification,
'to' => '/topics/updates'
);
this will call my onMessageReceived
when my app is in forground
but when my app is in background this will not call my onMessageReceived
the request is handled by system itself
i want to call my onMessageReceived
when my app is in background
i am also try to remove notification key
and only send data key
like this
$fields = array(
'data' => $notification,
'to' => '/topics/updates'
);
but when i send the request from above field onMessageReceived
is not called in both the condition in forground and background
i am try this in my xiaomi redmi note 4 (oreo)
, redmi 4x(android 10)
and android emulator(marshmello)
i am follow this ans for solve my problem but not work for me How to handle notification when app in background in Firebase
my FCM version is 17.3.4
and my android studio version is 3.5.3