【发布时间】:2019-12-24 14:50:33
【问题描述】:
我有一项服务每 1-3 秒左右接收一次位置更新。该服务是使用挂起的意图从主要活动启动的:
mFusedLocationClientFast.requestLocationUpdates(mLocationRequest, getPendingIntent());
其中getPendingIntent() 是一个方法,它定义了我的IntentService 在handleIntent() 中处理的操作
然而,我注意到一件奇怪的事情是,每次IntentService 处理handleIntent() 中的位置更新时,它总是紧接着调用同一服务的onStartCommand()。
有谁知道为什么每次服务处理意图时都需要调用onStartCommand()?
谢谢
【问题讨论】:
标签: android android-pendingintent intentservice location-updates