Aug 16, 2018 Replies: 2 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: Code: Copy #StartCommandReturnValue: android.app.Service.START_STICKY or Code: Copy Service.StartForeground 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 Code: Copy Sub Service_TaskRemoved StopService (Me) ExitApplication 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 Click to expand...
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: Code: Copy #StartCommandReturnValue: android.app.Service.START_STICKY or Code: Copy Service.StartForeground 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 Code: Copy Sub Service_TaskRemoved StopService (Me) ExitApplication 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
Erel B4X founder Staff member Licensed User Longtime User Aug 17, 2018 #2 Don't use sticky services. They will only cause problems on newer versions of Android.
scsjc Well-Known Member Licensed User Longtime User Aug 17, 2018 #3 Erel said: Don't use sticky services. They will only cause problems on newer versions of Android. Click to expand... thanks
Erel said: Don't use sticky services. They will only cause problems on newer versions of Android. Click to expand... thanks