Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/android/204.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Android 如何在intentService中获取设备位置?_Android_Location - Fatal编程技术网

Android 如何在intentService中获取设备位置?

Android 如何在intentService中获取设备位置?,android,location,Android,Location,我有警报,每隔15分钟呼叫我的intentService,在intentService中,我如何获取设备位置?(注意:我的intentService中有一个wakeLock)欢迎您尝试getLastKnownLocation(),但它很可能是null。而且,IntentService不能等待某个位置修复程序的到来 相反,您需要一个常规的服务,专门为处理这种情况而设计。我创建了一个()??

我有警报,每隔15分钟呼叫我的intentService,在intentService中,我如何获取设备位置?(注意:我的intentService中有一个wakeLock)

欢迎您尝试
getLastKnownLocation()
,但它很可能是
null
。而且,
IntentService
不能等待某个位置修复程序的到来


相反,您需要一个常规的
服务
,专门为处理这种情况而设计。我创建了一个()??