https://bugs.kde.org/show_bug.cgi?id=414120
FeRD (Frank Dana) <ferd...@gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |ferd...@gmail.com --- Comment #1 from FeRD (Frank Dana) <ferd...@gmail.com> --- I took a shot at reworking FindMyPhoneActivity to make use of newer Android APIs (on newer Android devices). The code should be considered a rough draft as it almost certainly needs additional polish, but it at least compiles and runs fine on Android 7 (which doesn't support those newer APIs, which makes it a poor test, but it's the best I can do). The code's in a branch on my GitHub fork of kdeconnect-android: https://github.com/ferdnyc/kdeconnect-android/tree/findmyphone-api-refresh I also created a PR in the KDE GitHub mirror (which was of course auto-closed, but I just wanted to get the code up somewhere): https://github.com/KDE/kdeconnect-android/pull/16 The text of that PR follows. ============================================================================ 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 7 phone, where it worked just the same as the version installed from Google Play. However, running on Android 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. -- You are receiving this mail because: You are watching all bug changes.