I want to create an activity that uses the intent action for 开发者_如何学编程Screen_off - is there an easy way to do this? I keep getting lost as to where I should start - does the screen_off activity need to be defined somewhere and then referred to?
There is no SCREEN_OFF activity. The SCREEN_OFF action is a broadcast. Further, it is not sent to applications that register through their manifest, so the only way to be called from it is to have something else running at the time that uses Context.registerReceiver() to receive that broadcast. (The reason for this is that turning the screen off and especially on needs to be fast, and allowing applications to be launched as part of that process can very easily cause a noticeable performance impact.)
精彩评论