从非绑定服务获取数据的Android
我目前我有运行不断抓住,我就开始引导我的GPS位置的绑定服务。然后,我有一个猜想图,其中我已经从服务提取数据的应用程序。
I currently I have an unbound service that is running continually grabbing my gps position that I start on boot. I then have an app that is suppose to plot where I've been by pulling data from the service.
我不能绑定谈论它的服务或一旦我关闭该应用程序将被销毁。
I can't bind the the service to talk to it or it will be destroyed once I close the app.
有没有什么好办法从一个未绑定的服务中获得数据,或从垂死保持一个绑定的服务,一旦我解除了吗?
Is there any good way to get data from an unbound service or keep a bound service from dying once I unbind it?
干杯! :)
有是保持服务活着的解决方法。通过调用startService打电话给你的服务,然后绑定到该服务。这样,你的活动是保持服务的生命周期。
There is a workaround for keeping your service alive. Call your service by calling startService and then bind to the service. This way your activity is maintaining the the lifecycle of the service.