How can I make my android app run on the background?

后端 未结 3 1697
予麋鹿
予麋鹿 2020-12-20 01:01

I build an application that collects data about the battery. In order to collect this data I need my application to run on the background in order to be able to collect this

3条回答
  •  别那么骄傲
    2020-12-20 01:29

     - @Override public int onStartCommand(Intent intent, int flags, int
       startId) {
           handleCommand(intent);
           // We want this service to continue running until it is explicitly
           // stopped, so return sticky.
           return START_STICKY; }
    

提交回复
热议问题