Summary: | Ring and photo not working in kdeconnect app when app is in background on Android 10. | ||
---|---|---|---|
Product: | [Applications] kdeconnect | Reporter: | Dashon <dashonwwIII> |
Component: | android-application | Assignee: | Albert Vaca Cintora <albertvaka> |
Status: | RESOLVED NOT A BUG | ||
Severity: | normal | CC: | andrew.g.r.holmes, ferdnyc, gimmeahint, sheepdestroyer |
Priority: | NOR | ||
Version First Reported In: | 1.3.2 | ||
Target Milestone: | --- | ||
Platform: | Ubuntu | ||
OS: | Other | ||
Latest Commit: | Version Fixed In: | ||
Sentry Crash Report: |
Description
Dashon
2019-11-14 03:50:21 UTC
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. can confirm with a pixel2-xl on android 10 It used to work with the same phone on android 8 and 9 Android 10 thing. |