Android Question Why the service stop alone? (solved)

dibesw

Active Member
Licensed User
Longtime User
I have an app that start 2 service and then finish:
B4X:
................  
StartService(Listphone)
StartService(Listsms)
Activity.Finish
Both of service works well and it starting automatically at boot.
If the phone is on always, the services are always on.
If I turn off the phone (button that off display), and then I turn on right after the services are on;
If I turn off the phone and I turn on after several seconds or minutes the services stop and out!
What is the reason?
It happens on different phones (android 4.4.2)
This is manifest:
B4X:
AddManifestText(
<uses-sdk android:minSdkVersion="5" android:targetSdkVersion="17"/>
<supports-screens android:largeScreens="true"
    android:normalScreens="true"
    android:smallScreens="true"
    android:anyDensity="true"/>)
SetApplicationAttribute(android:icon, "@drawable/icon")
SetApplicationAttribute(android:label, "$LABEL$")
'End of default text.
AddPermission(android.permission.WRITE_EXTERNAL_STORAGE)
AddApplicationText(<activity android:name="anywheresoftware.b4a.objects.preferenceactivity"/>)
I can not understand where the problem is!
 
Last edited:

dibesw

Active Member
Licensed User
Longtime User
I hope this is for help:

ba16.jpeg


ba17.jpeg
 
Upvote 0

coslad

Well-Known Member
Licensed User
Longtime User
Hi, you have to start a sticky service, if the system stop it, it will self restart.
 
Upvote 0
Top