Keeping a background service alive on Android

后端 未结 3 590
名媛妹妹
名媛妹妹 2021-01-23 06:22

In reference to Accelerometer seems to only work for a few seconds?

I\'m using the BOOT_COMPLETED broadcast event to call the following:

public class OnB         


        
3条回答
  •  时光说笑
    2021-01-23 06:53

    All you have to do to have a service that is constently alive is:

    
        
    

    2) onStartCommand should return:

     return Service.START_STICKY;
    

    and that's all buddy after I Start the service from the main activity it is on for the whole day/

提交回复
热议问题