开发者

need better explanation of services with explicid intents

there are a few intents i am looking to use and I am pretty sure that they cant be registered in the manifest such as action_screen_off.

so when i start the service:

context.startSer开发者_如何学Govice(new Intent(context, Service.class));

then the onCreate registers a broadcast reciever like this:

registerReceiver(screenReceiver, new IntentFilter(Intent.ACTION_SCREEN_ON));

and my onStartCommant returns start_not_sticky

the receiver should be fired each time the screen goes off correct? but it dosent. i tried this with a few different receivers like action_battery_changed and they dont work either. how do i get them to fire correctly?

maybe explain to me how it all works a little better


This should help

http://thinkandroid.wordpress.com/2010/01/24/handling-screen-off-and-screen-on-intents/

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜