BroadcastReceiver in android 7.0

て烟熏妆下的殇ゞ 提交于 2019-12-25 17:38:13

问题


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:

  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.


来源:https://stackoverflow.com/questions/44748132/broadcastreceiver-in-android-7-0

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!