Android Question Why not start again Stater service after close from recently app?

Discussion in 'Android Questions' started by Pooya1, Aug 12, 2018.

  1. Pooya1

    Pooya1 Active Member Licensed User

    Hi
    All of things is good
    Problem is when user close app from recent app but starter service not start again
    I have problem in android 8 and i dont test in below 8 version android
    But android 8 is very important
    Because i connect to b4j socketserver in starter and it must be connect to server after close app
    Thanks
     
  2. Pooya1

    Pooya1 Active Member Licensed User

    Problem was solved
    I start again Starter service with :
    Code:
    StartServiceAt("",DateTime.Now + 2000,True)
     
  3. DonManfred

    DonManfred Expert Licensed User

    Android will kill your app if you want to restart your service 2 Seconds after it finishes
    You should not start (or stop) the Starterservice manually.
     
  4. Pooya1

    Pooya1 Active Member Licensed User

    But i use it and didn't have any problem in android 8
    If my way is mistake so what way do i use it? i need service start again
     
  5. LucaMs

    LucaMs Expert Licensed User

    Then this time something in your code should be wrong, do not you agree?

    B4A 8.30 helps to keep the Starter service alive:
     
  6. Pooya1

    Pooya1 Active Member Licensed User

    Ok i agree it,but how do can i live it after close app from recently?
    Thanks
     
  7. LucaMs

    LucaMs Expert Licensed User

    As far as I know it should remain active. Have you tried a half-empty project?
    I do not have Android 8 (I have an Android 7 and I'm waiting for the manufacturer to provide the update :mad:)
     
  8. Pooya1

    Pooya1 Active Member Licensed User

    :D
    No in android 7 and below i dont have problem
    Problem is in android 8 that i try start again Starter service and it is working now :cool:
     
  9. LucaMs

    LucaMs Expert Licensed User

    I meant: have you tried-tested a simply new half-empty project on your Android 8?

    Just to check if even with this "app", removing it from "recents", the starter does not restart.




    Have to watch Sevilla - Barcelona (football) now :)
     
  10. Pooya1

    Pooya1 Active Member Licensed User

    I test in empty project and remove app from recent but starter not start again
     
  11. Erel

    Erel Administrator Staff Member Licensed User

    The process is killed when the user swipes it from the recent apps list. There is no reason for the starter service to start again.

    You can make your service a foreground service. This way the process will not be killed and it will keep running.
     
    Pooya1 likes this.
  12. LucaMs

    LucaMs Expert Licensed User

    LOL :eek:

    I thought that he started the app after removing it from the Recents and the Starter did not start!

    :D
     
  13. Pooya1

    Pooya1 Active Member Licensed User

    If i foreground service,dont show notification in statusbar in starter service?
     
  14. DonManfred

    DonManfred Expert Licensed User

    A foreground service needs an notification visible
     
    Pooya1 likes this.
  15. Pooya1

    Pooya1 Active Member Licensed User

    It is way for unvisible notification so i use it :p
     
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