1. *** New version of B4J is available ***
    B4J v7.8
    Dismiss Notice

Android Question Notification Icon stays at notification panel

Discussion in 'Android Questions' started by tufanv, May 15, 2019.

  1. tufanv

    tufanv Expert Licensed 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 ?

    Code:
    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
     
    stingrae likes this.
  2. DonManfred

    DonManfred Expert Licensed User

    Are you using any Foregroundservice in your app?
     
    Erel likes this.
  3. Erel

    Erel Administrator Staff Member Licensed 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) ?
     
  4. tufanv

    tufanv Expert Licensed User

    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 ?
     
  5. tufanv

    tufanv Expert Licensed User

    No I don't
     
  6. Erel

    Erel Administrator Staff Member Licensed 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.
     
  7. tufanv

    tufanv Expert Licensed User

    I didnt know that sorry. I will read this.

     
Loading...
  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice