<application>
<receiver android:name=".MyBroadcastReceiver" android:enabled="true">
<intent-filter>
<action android:name="android.intent.action.ACTION_SCREEN_ON"></action>
<action android:name="android.intent.action.ACTION_SCREEN_OFF"></action>
</intent-filter>
</receiver>
...
</application>
MyBroadcastReceiver
设置只是吐FOO的日志。什么都不做。
有什么建议吗?我是否需要指定任何权限赶上意图是什么?
MyBroadcastReceiver
is set just to spit foo to the logs. Does nothing.
Any suggestions please? Do I need to assign any permissions to catch the intent?
我认为,这些行为只能通过在Java中code(注册接收机通过 registerReceiver()接受
),而不是通过在清单中注册的接收器。
I believe that those actions can only be received by receivers registered in Java code (via registerReceiver()
) rather than through receivers registered in the manifest.