Android LocationLister implemented in IntentService never execute the OnLocationChanged() method

故事扮演 提交于 2019-12-04 11:15:52

I've written an IntentService which implements the LocationListener interface.

That is not a good idea. An IntentService should not do anything that lives past the onHandleIntent() method.

The service should send a message when OnLocationChanged() method was called at the first time. But OnLocationChanged() is never called.

This is not surprising, as the service will be destroyed a millisecond or so after it is created, based upon your implementation.

If your objective is to have a reasonably current location at all times, try the Little Fluffy Location Library. Or, consider my LocationPoller.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!