Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Migrate to using onAudioFocusChange() instead of READ_PHONE_STATE? #104

Open
scottg489-tw opened this issue Mar 14, 2022 · 0 comments
Open

Comments

@scottg489-tw
Copy link

We're using this library to handle media behavior in our app to pause/resume when a phone call starts/stops. Looking over Android documentation I came across this:

https://developer.android.com/training/permissions/evaluating#pause-media

Which states:

If the user receives a phone call, or if a user-configured alarm occurs, your app should pause any media playback until your app regains audio focus.

To support this functionality, don't declare the READ_PHONE_STATE permission. Instead, implement the onAudioFocusChange() event handler, which runs automatically when the system shifts its audio focus. Learn more about how to implement audio focus.

This project's README states that:

The package will request for READ_PHONE_STATE permission in android.

Given the above documentation, does that mean that the proper way to handle these events would be to use onAudioFocusChange() instead of requesting the READ_PHONE_STATE permission? And if so, would it be possible for this lib to be updated accordingly?

@scottg489-tw scottg489-tw changed the title Is READ_PHONE_STATE necessary? Migrate to using onAudioFocusChange() instead of READ_PHONE_STATE? Mar 14, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant