Starting background service when Android turns on

后端 未结 2 635
难免孤独
难免孤独 2020-12-30 11:18

I need to have ALWAYS a background service that will synchronize my Android application and a server. I know how to launch it through my application, but when the Android tu

2条回答
  •  挽巷
    挽巷 (楼主)
    2020-12-30 11:50

    (Even when the device turns off and then turns on..
    

    The OS broadcasts ACTION_BOOT_COMPLETED when it has finished booting. Your app can ask to receive this notification by requesting permission in your manifest:

    
    
    

    http://blog.gregfiumara.com/archives/82

    http://www.androidcompetencycenter.com/2009/06/start-service-at-boot/

提交回复
热议问题