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

Find My Phone plugin API refresh #16

Closed
wants to merge 2 commits into from

Conversation

ferdnyc
Copy link

@ferdnyc ferdnyc commented Nov 25, 2019

This is an update to the FindMyPhone plugin, attempting to make use of newer APIs to more correctly manage audio playback on newer Android releases. Highlights:

KDE Connect-wide

  • Raise minSdkVersion from 14 to 21 (To access more recent APIs w/o lots of legacy fallback.)
  • Add WAKE_LOCK to permissions requested in manifest file.

FindMyPhoneActivity

  • Use AudioAttributes to replace deprecated SetAudioStreamType()
  • Request & manage audio focus, on Android 26+
  • Prevent screen / CPU sleep during playback (using WAKE_LOCK)
  • Prepare MediaPlayer asynchronously, and release() when done

I'll be honest, I wrote this code working off of API docs and code samples, but I'm not supremely confident that it's all correct. It compiles with no problems, and I built and installed it as an APK on my Android 6 7 phone, where it worked just the same as the version installed from Google Play. However, running on Android 6 7 means that most of the newer APIs (including Audio Focus) aren't accessed, and I don't have a newer device to test on. (Trying to run the app in an emulator failed, network-connectivity wise... I ended up with GSConnect trying to pair with itself.)

So, I'm submitting this in case it might be useful, but I would be surprised if it doesn't need at least some cleanup. It certainly needs testing on newer devices, something I'm unable to do myself.

Signed-off-by: FeRD (Frank Dana) <ferdnyc@gmail.com>
- Use AudioAttributes to replace deprecated SetAudioStreamType()
- Request & manage audio focus, on Android 26+
- Prevent screen / CPU sleep during playback
- Prepare MediaPlayer asynchronously, and release() when done

Signed-off-by: FeRD (Frank Dana) <ferdnyc@gmail.com>
@tsdgeos
Copy link
Contributor

tsdgeos commented Nov 25, 2019

Thanks for your contribution 😃

This repository is a mirror of a KDE repository. This means that developers are not looking at pull requests created in GitHub, so I'm closing this pull request (actually a bot is doing it).
Please see https://community.kde.org/Infrastructure/Github_Mirror for details on how to contribute to this and other KDE projects.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
2 participants