Bug 447498

Summary: Minor issue, Android app says battery information not available
Product: [Applications] kdeconnect Reporter: Mark de Wet <mark.de.wet>
Component: android-applicationAssignee: Albert Vaca Cintora <albertvaka>
Status: RESOLVED FIXED    
Severity: normal CC: ferdnyc, not-a-penguin, paralel.nonrecurently, smowtenshi
Priority: NOR    
Version First Reported In: unspecified   
Target Milestone: ---   
Platform: Android   
OS: Microsoft Windows   
Latest Commit: Version Fixed/Implemented In:
Sentry Crash Report:
Attachments: connect indicator screenshot (no data, -1% reported)

Description Mark de Wet 2021-12-25 08:56:52 UTC
SUMMARY
***
NOTE: If you are reporting a crash, please try to attach a backtrace with debug symbols.
See https://community.kde.org/Guidelines_and_HOWTOs/Debugging/How_to_create_useful_crash_reports
***


STEPS TO REPRODUCE
1. 
2. 
3. 

OBSERVED RESULT


EXPECTED RESULT


SOFTWARE/OS VERSIONS
Windows: 
macOS: 
Linux/KDE Plasma: 
(available in About System)
KDE Plasma Version: 
KDE Frameworks Version: 
Qt Version: 

ADDITIONAL INFORMATION
Hi, sorry I am new to this so please bear with me. I'm running KDEConnect on Windows 10/Android 11 and most things work very well, except for the battery level indicator. At the bottom of the Android app, below the menu for send files etc it says "Status battery information not available. Is this a permission error or something else? It is a minor bug, but something I would like to have back (it worked on my LG G4 with Android 7)
Comment 1 Tux 2022-04-03 18:49:54 UTC
Created attachment 147941 [details]
connect indicator screenshot (no data, -1% reported)
Comment 2 Tux 2022-04-03 18:55:03 UTC
Comment on attachment 147941 [details]
connect indicator screenshot (no data, -1% reported)

Same thing here with Android 10 (Oppo Color OS flavour, unsure if that is the cause or not, I can't change or try any other phone OS right now) and KDEConnect on Arch on the other side.

So far  the same notification appears on the phone and and no battery usage % is displayed at  all on the computer side, neither on the qt app,  kde cli or Gconnect (which doesn't really matter here, but I tested it too).


https://i.imgur.com/s4qFxO6.png



d’abr. 03 20:45:31 honk-a-tron kdeconnectd[1827]: no pair requests to accept!
d’abr. 03 20:46:06 honk-a-tron kdeconnectd[1827]: kdeconnect.plugin.contacts: handleResponseVCards: Unable to open "/home/tux/.local/share/kpeoplevcard/kdeconnect-009186294aa5a9f4/3047i55a861>
d’abr. 03 20:46:28 honk-a-tron kdeconnectd[1827]: kdeconnect.plugin.battery: No Primary Battery detected on this system. This may be a bug.
d’abr. 03 20:46:28 honk-a-tron kdeconnectd[1827]: kdeconnect.plugin.battery: Total quantity of batteries found:  0
d’abr. 03 20:46:28 honk-a-tron kdeconnectd[1827]: kdeconnect.plugin.contacts: handleResponseVCards: Unable to open "/home/tux/.local/share/kpeoplevcard/kdeconnect-009186294aa5a9f4/3047i55a861>
d’abr. 03 20:46:36 honk-a-tron kcmshell5[197882]: qt.svg: Cannot open file ':/icons/kdeconnect/kdeconnect.svg', because: No such file or directory
d’abr. 03 20:46:36 honk-a-tron kcmshell5[197882]: qt.svg: Cannot open file ':/icons/kdeconnect/kdeconnect.svg', because: No such file or directory
d’abr. 03 20:46:54 honk-a-tron drkonqi[197949]: QSystemTrayIcon::setVisible: No Icon set
Comment 3 Tux 2022-04-03 19:03:48 UTC
Comment on attachment 147941 [details]
connect indicator screenshot (no data, -1% reported)

Operating System: Arch
KDE Plasma Version: 5.24.4
KDE Frameworks Version: 5.92.0
Qt Version: 5.15.3
Kernel Version: 5.15.32-1-lts (64-bit)
Graphics Platform: X11
Processors: 4 × AMD Ryzen 3 2200G with Radeon Vega Graphics
Memory: 19,5 GiB of RAM
Graphics Processor: AMD Radeon RX 570 Series
Comment 4 FeRD (Frank Dana) 2022-05-21 00:55:07 UTC
(In reply to Mark de Wet from comment #0)
> At the bottom of the Android app, below the menu for send
> files etc it says "Status battery information not available. Is this a
> permission error or something else? 

_That_ message, in the "Status" area at the bottom of the device details page in the Android app, is actually related to the **paired** device that's currently selected. Specifically, in this case, it would be the PC your phone is paired with. The Android app is (correctly) reporting that it isn't able to retrieve battery-level information from your Linux system.

So, it's normal that you'd see that message, and it's unrelated to KDE Connect on your Linux system showing or not showing battery information for the phone. As long as the battery plugin is enabled on the phone (from that same screen, upper-right-corner menu, "Plugin settings", and then enable "Battery report"), you *should* see battery data for it on the Linux side.

I don't know of any permission specific to reading the device's battery level, but the permission that would be most likely to affect that is the "Phone" permission. (Which also controls access to things like network signal levels, etc.)

Additionally, you may need to go into your phone's preferences for the app (Android's Settings > Apps > KDE Connect), tap "Battery", and set the mode to at least "Optimized", possibly "Unrestricted", to ensure that the app is able to provide battery (and other) data request. The more recent the Android release, the more aggressively it will attempt to powersave the app, which can sometimes interfere with its ability to handle network requests from the Linux side.
Comment 5 Albert Vaca Cintora 2023-04-01 09:47:41 UTC
We had to disable reporting the battery on Windows due to a bug. Until we fix that, I think we just shouldn't sow any battery information instead of that message. I'll change that.
Comment 6 Bug Janitor Service 2023-04-01 09:50:27 UTC
A possibly relevant merge request was started @ https://invent.kde.org/network/kdeconnect-android/-/merge_requests/331
Comment 7 Albert Vaca Cintora 2023-04-01 19:18:58 UTC
Git commit a1d7e822e7d3f60e6f1f83481e47ad18ce96bb55 by Albert Vaca Cintora.
Committed on 01/04/2023 at 19:18.
Pushed by albertvaka into branch 'master'.

Don't show any message if battery information is not available

M  +0    -1    res/values/strings.xml
M  +1    -7    src/org/kde/kdeconnect/UserInterface/DeviceFragment.kt

https://invent.kde.org/network/kdeconnect-android/commit/a1d7e822e7d3f60e6f1f83481e47ad18ce96bb55