Android Question Problem with firebase notification (again).

Eme Fibonacci

Well-Known Member
Licensed User
Longtime User
I have an android 8.1.

I read a lot topics with same question. Nothing worked for me.
I have a basic implementation of FCM and everything works fine.

If I hit the home key the application goes to the background and everything still works fine.

If I press the right button (I forgot the name) and then click on "clear all" the notification no longer works.

If the app is left unused for a long time (Probably the android is killing it) the notification don't work anymore.

What better way to solve it?

Sorry for this repetitive question.

Thank you for you time.
 

Eme Fibonacci

Well-Known Member
Licensed User
Longtime User
Are you testing it in release mode? Are you sending the message with the B4J tool?

Yes release mode.
With firebase console and B4J tool.

I've tried countless things.
I found this in some tutorial. This seems to work.
B4X:
Service.StartForeground(nid, CreateNotification("..."))

Maybe this code is incorrect but it seems to work.
 
Upvote 0

Erel

B4X founder
Staff member
Licensed User
Longtime User
With firebase console
Don't. It will not work when your app is not running.

I found this in some tutorial. This seems to work.
Wrong solution. The app doesn't need to run for the notification to arrive.

Firebase notifications work properly on almost all devices when implemented correctly. On some devices the OS limits background notifications based on all kinds of parameters. However if your app doesn't work on several devices then you did something wrong.
 
Upvote 0
Top