How to deal with removal of a permission for a broadcast receiver in Android M?

前端 未结 3 604
南笙
南笙 2021-01-31 16:59

I\'ve got some legacy code which I am making permission safe for Marshmallow.

There is a broadcast using the PHONE_STATE permission as follows:



        
3条回答
  •  天命终不由人
    2021-01-31 17:44

    Tried to reproduce the issue on 6.0.1 with no success. I'm attaching a link for the test project I used.
    The scenario is simple:

    1. Run with the permission ON. Everything works as expected. The onReceive is called.
    2. Turn OFF the permission. The expected result of the app crashing when phone state changed, does not occur.

    Unless anyone has a different result I think this issue is "solved" in a way.

提交回复
热议问题