Android Question Icon is a white circle when receiving Firebase notification

Status
Not open for further replies.

janderkan

Well-Known Member
Licensed User
Longtime User
I am using Android 28, B4A 8.80
SDKmanager is used to update everything.
I have managed to use adaptive icons.

But I cannot figure out how to show the correct notification icon when receiving a Firebase notification.
I only want to show the notification when the app is not in foreground, so I do not handle the notification in my app.
Everything works fine on older Android versions.
Newer Android versions shows the notification but the icon is just a white circle.
 

janderkan

Well-Known Member
Licensed User
Longtime User
Are you calling Service.StopAutomaticForeground? Try to create the notification with NB6.

Yes I have StopAutomaticForeground in Service_Start of FirebaseMessaging.
I do not create the notification.
I have just subscribed to a Firebase notification that is shown automatically when the App is in background.
The text, sound and icon is defined in the notification, comming fra an B4R project.
Works fine on older Android.
I have tried to remove the icon part from the notification, hoping it would use the default icon. No luck.
I found somewhere that I should create a ic_notification.png and put it in the mipmap folder, but again, no luck.
The icon used to be a white square until I change to an adaptive icon, now it is white round.
 
Last edited:
Upvote 0

janderkan

Well-Known Member
Licensed User
Longtime User
There is no such thing.

Sorry for being annoying, but there is.
I will send the project to you.

This is the message I send from B4R HttpJob:
B4X:
{"notification":
{"sound":"a1.wav",
"icon":"d7",
"tag":"dt",
"title":"Garage test",
"body":"Lukker"},
"collapse_key":"dta",
"to":"\/topics\/25031-10000-5C_CF_7F_C3_CA_36-7",
"priority":"high"}

The icons are in drawable folder.
The sounds are in raw folder.

When the app is in background the notification are shown automatically.
When the app are in foreground the fm_MessageArrived sub is called.

This works on both B4A and B4I.

On B4A old Android everything is fine.
In new Android it works but the icon is just white circle.
 
Upvote 0

Erel

B4X founder
Staff member
Licensed User
Longtime User
I will send the project to you.
No need.

You should start by exactly following the tutorial. This means that you should send the messages with the B4J tool. Once you get it working you should switch to B4R.

When the app is in background the notification are shown automatically.
No. It is your code. Watch the video tutorial.
 
Upvote 0

janderkan

Well-Known Member
Licensed User
Longtime User
No need.

You should start by exactly following the tutorial. This means that you should send the messages with the B4J tool. Once you get it working you should switch to B4R.


No. It is your code. Watch the video tutorial.

No I did not write any code to show the notification, please see project.
 
Upvote 0
Status
Not open for further replies.
Top