I am working with a broadcastreceiver in android 7 but it is not working properly so Do we need to register the broadcastreceiver using registereceiver() inorder to work with broadcast reviver in android 7.
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试):
问题:
回答1:
There are only 2 changes related to broadcast receivers in android 7:
- Apps targeting Android 7.0 (API level 24) and higher do not receive CONNECTIVITY_ACTION broadcasts if they declare their broadcast receiver in the manifest. Apps will still receive CONNECTIVITY_ACTION broadcasts if they register their BroadcastReceiver with
Context.registerReceiver()
and that context is still valid. - The system no longer sends ACTION_NEW_PICTURE or ACTION_NEW_VIDEO broadcasts. This optimization affects all apps, not only those targeting Android 7.0.