Android Question How to change service start at boot to true or false programmatically

Discussion in 'Android Questions' started by Rick Harris, Apr 1, 2015.

  1. Rick Harris

    Rick Harris Well-Known Member Licensed User

    I want to make it possible for a user of my app to decide whether the app should startup automatically at boot. For this purpose I am using a servive. How can I change start at boot to true or false programmatically in a service?
     
  2. DonManfred

    DonManfred Expert Licensed User

    I think you cant
     
  3. JordiCP

    JordiCP Well-Known Member Licensed User

    Just guessing, don't know if it is very "neat". The service will always start but it will kill itself if user has chosen "NO-STARTUP-AT_BOOT" (the service will retrieve this info from somewhere)
     
  4. Rick Harris

    Rick Harris Well-Known Member Licensed User

    Thank you all. I think I will add two identical (kiosk) services to my project: One that has StartAtBoot set to true and the other to false. The user will be able to set an autoboot integer to 0 or 1 that will determine which of the two services will be activated by my app. Pity that there is no simpler way (unless Erel has some ideas).
     
  5. Erel

    Erel Administrator Staff Member Licensed User

    I agree with @JordiCP. Always let the service start and in Service_Create decide whether you need to stop or continue.
     
    Rick Harris 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