Android Question my service not start when boot

DarkSmart

Member
Licensed User
Hi
my problem is my service not auto start when android boot
i use this code in service:
B4X:
#StartAtBoot: true
#StartCommandReturnValue: android.app.Service.START_STICKY
And give this permission:
B4X:
android.permission.RECEIVE_BOOT_COMPLETED
android.permission.WAKE_LOCK
such add this code in manifest:
B4X:
AddReceiverText(bootreciver,<intent-filter>
            <category android:name="android.intent.category.DEFAULT" />
            <action android:name="android.intent.action.QUICKBOOT_POWERON"/>
            <action android:name="com.htc.intent.action.QUICKBOOT_POWERON"/>
         </intent-filter>)
but not working and not auto start my service
i test in many device
help
 

Erel

B4X founder
Staff member
Licensed User
Longtime User
1. Don't use START_STICKY. It doesn't do anything useful in newer versions of Android.

2. Make sure not to use the starter service for this.

3. No need to add these permissions yourself.

4. How do you see that it is not starting? Try to show a notification from your service.

5. Monitor the logs with USB debug mode.
 
Upvote 0
Top