4 ms·
> For VLC on Android, we need the READ_PHONE_STATE permission, in order to stop the music when a phone call is coming in. We just use it to make pause on incomi
by masklinn 12y ago
> For VLC on Android, we need the READ_PHONE_STATE permission, in order to stop the music when a phone call is coming in. We just use it to make pause on incoming call.
It's seriously back-asswards that you'd have to have access to all phone state just to be able to start and stop audio on phone calls.
By comparison iOS has an audio interruption system which gets triggered on phone calls, alarms (calendar and clock) and other applications taking over the audio, the application getting interrupted neither not knows nor cares where the interruption comes from, only that it doesn't have the audio stream anymore.
- quantumet 12y agoSo does Android: http://developer.android.com/training/managing-audio/audio-focus.html http://developer.android.com/training/managing-audio/audio-f... http://android-developers.blogspot.com/2013/08/respecting-audio-focus.html http://android-developers.blogspot.com/2013/08/respecting-au...
- jbk 12y agoWe're already doing this. It's not enough. See our source code.
- yincrash 12y agoCould you link to the relevant class?
- jbk 12y agosrc/org/videolan/vlc/audio/AudioService.java
- mlrtime 12y agolink to method (I think): https://github.com/mstorsjo/vlc-android/blob/master/vlc-android/src/org/videolan/vlc/audio/AudioService.java#L330 https://github.com/mstorsjo/vlc-android/blob/master/vlc-andr...
- deleted 12y ago[deleted]
- TheQwerty 12y agoCuriously, it looks like Google's AOSP music app requests READ_PHONE_STATE but unless I'm missing something they don't use it - relying entirely on focus loss instead. Granted, I'm not sure anything actually uses this code now... https://github.com/android/platform_packages_apps_music https://github.com/android/platform_packages_apps_music http://androidxref.com/5.0.0_r2/xref/packages/apps/Music/ http://androidxref.com/5.0.0_r2/xref/packages/apps/Music/
- deleted 12y ago[deleted]
- gabemart 12y agoThis simply doesn't work for pausing audio when the phone rings. The ringer doesn't request audio focus.
- leni536 12y agoThe ringer doesn't request audio focus. I would think that this is a bug in the ringer and not an overall limitation of the Android permission system.
- ygra 12y agoWhich doesn't really help the users stuck on Android versions that never get any update or bugfixes. In which case apps have to take the pragmatic route and just work around the issue. Even if that requires a scary permission. No user would point to Google and say »VLC doesn't pause when the phone rings, fix the ringer, please.«. Rather they point to VLC and say »VLC doesn't pause when the phone rings, fix VLC please.«
- tripzilch 12y agoWould be nice if you could request "you're using an older version of Android so we need more scary permissions".
- krschultz 12y agoYou can. Split your APK based on SDK version. Have different manifests with different permissions & code for the respective versions. The new Gradle toolchain makes all of that easy to do, but it is tough to maintain lots of version specific code long term.