开发者

Alternatives to using a Service for BroadcastReceiver Logging

Seems that a Service on Android is not the most popular method for implementing a persistent process for performing some background activity i开发者_StackOverflow中文版n Android. The suggestion is to use something like the alarm manager - however I am not sure if it is applicable to my situation. Advice welcomed.

What I am trying to implement is some background process that receives selected broadcasts. This process does some processing on the broadcast, and for example logs the results to a file. I can work out how to do this with a Service OK, but in earlier Android versions, the service seems to be killed relatively easily.

Are there alternatives to a service in this kind of application ??

Thanks


I think I have just found the answer... and basically the broadcast reciever is the mechanism for achieving it... The broadcast should be able to find the relevant receiver and start it for a limited period of time...

Need to check if i can receive cell location updates as a Broadcast Receiver though...

thanks


You can do it in your onReceive() method of the class that extends BroadcastReceiver.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜