BroadcastReceiver in android 7.0

2019-09-19 20:30发布

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条回答
Lonely孤独者°
2楼-- · 2019-09-19 20:58

There are only 2 changes related to broadcast receivers in android 7:

  1. 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.
  2. 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.
查看更多
登录 后发表回答