Push Notifications Android in kill state

Hello,

I am not able to receive the sendbird chat notifications when the app is in kill state. In foreground and background i am able to receive the notification through the FirebaseMessaging service class extending the SendBirdPushHelper as mentioned in docs. Can anybody help

Hello @Meet ,
I think there’s a possibility that SendBird.init is not called.
I wonder where are you calling SendBird.init.
If you are not calling it in Application.onCreate, then Sendbird.init may not be called.

Could you check this out? Thank you.

Thanks for the reply, will check and let you know i am intializing it in the splash screen

Nope its still not working @Jerry_Jeon

Actually issue is not with intialization if it was with the intialization then notifications shouldn’t be coming in the foreground and background. It is not received only when we clear app from the recent task else its running perfectly where else our backend also sends notification through FCM server but it is received even though the app is in killed state. Thanks Looking Forward to your response @Jerry_Jeon

@Meet
You mentioned intializing it in the splash screen, if it means you are calling SendBird.init in your Activity it could be a problem.
Because when you clear the app from the recent task and receive an FCM message, Your activity would not be created so SendBirdni.init will not be called.
But for the same situation Application.onCreate will be called, so it’s safe to place calling SendBird.init.

And I found another case that could be a problem.
You should call registerPushHandler in your Application.onCreate, and be careful to not call it in SendBird.InitResultHandler

To summarize, to enable push notification, code should be like this

class MyApplication extends Application {
    @Override
    public void onCreate() {
        SendBird.init(...);
        SendBirdPushHelper.registerPushHandler(...);
    }
}

okay let me try this

Hello @Jerry_Jeon The issue is resolved. Thanks for helping out. It actually because of the application context as you mentioned in your last reply :blush:

@Meet Good to hear that! Have a good day :hugs: