Android Question Notification Icon stays at notification panel

tufanv

Expert
Licensed User
Longtime User
Hello,

I am getting some reviews on Google play that My app's icon stays at the notification window and it can't be removed by the users. I don't understand how but is this possible ? Maybe I am doing something wrong ?

Can it be because of these 2 lines added to firebase notifications tutorial by Erel ?

B4X:
Sub Service_Start (StartingIntent As Intent)
   If StartingIntent.IsInitialized Then fm.HandleIntent(StartingIntent)
   Sleep(0)
   Service.StopAutomaticForeground 'remove if not using B4A v8+.
End Sub

sleep 0 and service.stopautomatic.. is added later and my app doesn't have that. All the other code is the same with the tutorial.

Thanks
 

tufanv

Expert
Licensed User
Longtime User
These two lines remove the automatic notification.

Do you have any other service that can start in the background? Are you using the latest version of OkHttpUtils2 (2.82) ?

What do you mean by removing the automatic notification ?

I am using okhttputils2 2.82
I don't have any other service that can start in the background.

also you have written in automatic foregorund mode : " If you don't stop the automatic foreground mode then a notification icon will be left after the task completed." maybe that is related ?
 
Upvote 0

Erel

B4X founder
Staff member
Licensed User
Longtime User
Important to read: Automatic Foreground Mode

Based on your description it is a foreground service, assuming that you haven't created an on going notification.

If you never call Service.StartForeground then this is the automatic foreground mode notification. Make sure that all your services call Service.StopAutomaticForeground in Service_Start. The Sleep(0) is not important.
 
Upvote 0

tufanv

Expert
Licensed User
Longtime User
I didnt know that sorry. I will read this.

 
Upvote 0

tufanv

Expert
Licensed User
Longtime User
I have firebasemessaging, starter service and httputils2 service , Do I need to add these to all these services ? Currently I only have this in firebasemessaging service but notification icons can't be removed by users.
 
Upvote 0
Cookies are required to use this site. You must accept them to continue using the site. Learn more…