Why does the Cordova media card need READ_PHONE_STATE permission?

So why does cordova-plugin-media add READ_PHONE_STATE permission?

I found a commit in Chromium https://chromiumcodereview.appspot.com/12480009/ which may be related. It seems that MediiaPlayerListener.java has refused READ_PHONE_STATE permission.

Can we do the same with the cordova plugin? Thanks.

+6
source share
1 answer

I have found the answer. The media cordova plugin seems to be listening for state changes like ringing or idle to mute. These events are dispatched by the cordova-android platform itself, listening to the PhoneStateListener events ( https://developer.android.com/reference/android/telephony/PhoneStateListener.html ).

Apparently, prior to Android API 22, this required READ_PHONE_STATE permission. For API 23, permission is no longer required.

Here is a stackoverflow answer pointing to commit in Android that changed this. Since Android 6.0 listening for changes to PhoneStateListener.LISTEN_DATA_CONNECTION_STATE no longer requires READ_PHONE_STATE permission

+4
source

Source: https://habr.com/ru/post/1011616/


All Articles