How to start long running background task in android service

后端 未结 2 1177
醉话见心
醉话见心 2021-01-05 08:25

Having read most of the available documentation on Android services on the developer site and here in stackoverflow, I\'m still confused by several aspects of running a serv

2条回答
  •  天命终不由人
    2021-01-05 09:07

    I think you could use a IntentService which you run by setting up a (regular) alarm (AlarmManager.setRepeating) with a PendingIntent in it. You can notify the UI by broadcasting an Intent from the IntentService and receiving it in your UI through a BroadcastReceiver.

提交回复
热议问题