Android Tutorial A trick for a badly closed application from a KILL TASK

Discussion in 'Tutorials & Examples' started by scsjc, Aug 16, 2018.

  1. scsjc

    scsjc Well-Known Member Licensed User

    I found it hard to find a solution to a problem that I think someone else could have
    if you leave a service running with:

    The problem appears when someone KILL TASK APP, then your application has not just closed, and sometimes some variables, or service processes prevent the application from running correctly, being useless "even until the next restart of the phone"

    The easiest solution I've found and I think it can help someone in a situation like this is add these lines to starter service

    Sub Service_TaskRemoved
    StopService (Me)
    End Sub
    When it detects the KILL of the APP, it has just closed the service and the application ...
    that way, the next time it is loaded it starts from 0 perfectly
    JohnC likes this.
  2. Erel

    Erel Administrator Staff Member Licensed User

    Don't use sticky services. They will only cause problems on newer versions of Android.
    scsjc likes this.
  3. scsjc

    scsjc Well-Known Member Licensed User

  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