从非绑定服务获取数据的Andr​​oid [英] Getting data from an Unbound Service in Android

查看:147
本文介绍了从非绑定服务获取数据的Andr​​oid的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我目前我有运行不断抓住,我就开始引导我的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.

这篇关于从非绑定服务获取数据的Andr​​oid的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆