Android Question Notification icon getting stuck on Android 8+

techknight

Well-Known Member
Licensed User
Longtime User
I am noticing a problem as more and more devices get updated with Android 8 and higher.

The notification icon generated by my app from the services starting, is staying there. Even after I exit the app. This requires a device reboot to get rid of it.

This only happens sometimes. But when this does happen, and Istart the App again, i will have 2 icons up there instead of 1.

Here is my service code:
B4X:
Sub Service_Create
    sNotif.Initialize
    sNotif.Icon = "icon"
    RxTimeout.Initialize("RxTimer", 1000)
    RxTimeout.Enabled = False
    EventTimer1.Initialize("EventTimer1", 500)
    EventTimer1.Enabled = False
    RefreshTNC = False
    serial1.Initialize("serial1")
    sNotif.Sound = False
    sNotif.SetInfo("SCB3000","Tap to bring on top.",Main)
    sNotif.Notify(1) 
    Service.StartForeground(1,sNotif)
    Service.StopAutomaticForeground
End Sub

Here is my app finished code:
B4X:
    If UserClosed = True Then
        Dim P As PhoneWakeState
        P.ReleaseKeepAlive
        P.ReleasePartialLock
        mnuDisconnect_Click
    '    DisableAll
        StopService("CommEngine")
        StopService("ScoreEngine")
        ExitApplication
    End If

I didnt have these issues with older android versions of course.

I added ExitApplication, and StopAutomaticForegraound in an attempt to potentially fix the issue. But it did not

any thoughts? Thanks.
 
Top