Android Question my service not start when boot

Discussion in 'Android Questions' started by DarkSmart, Jun 5, 2019.

  1. DarkSmart

    DarkSmart Member Licensed User

    Hi
    my problem is my service not auto start when android boot
    i use this code in service:
    Code:
    #StartAtBoot: true
    #StartCommandReturnValue: android.app.Service.START_STICKY
    And give this permission:
    Code:
    android.permission.RECEIVE_BOOT_COMPLETED
    android.permission.WAKE_LOCK
    such add this code in manifest:
    Code:
    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
     
  2. Erel

    Erel Administrator Staff Member Licensed 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.
     
    DarkSmart likes this.
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