How to programmatically detect SONY - Stamina device energy profile is ON
Asked Answered
P

2

9

I want to notify user that my app will not work properly if he has SONY android phone with STAMINE energy profile ON. This profile is blocking AlarmManager and device is not waked up when I want.

Prioress answered 17/9, 2013 at 8:59 Comment(1)
Yes, please - here too! See also [How to detect STAMINA mode?][1] [1]: https://mcmap.net/q/954176/-how-to-detect-stamina-modeGiverin
C
4

Currently, there is no official way to detect if the STAMINA energy profile is selected. However, if there is enough community demand we may be able to open this up.

Crosslet answered 6/11, 2013 at 21:35 Comment(4)
Yes, it would be good to have. Then I can inform user about adding my app into stamina whitelist.Misjudge
I would like to have this option too.Freehearted
@marlin-sony Any updates on that? Is there any unofficial way to detect STAMINA mode?Kimbra
Note that "STAMINA" mode doesn't trigger the power saving mode listeners that recent Android version uses, which it definitely should...Marlenamarlene
S
1

You could check it via

Settings.Secure.getInt(contentResolver, "somc.stamina_mode", 0) == 1

Works at least on the Sony Xperia XZ1 Compact (8.0.0)

Snorkel answered 7/6, 2018 at 12:10 Comment(1)
Note that this only detects if the mode is enabled, not whether it is currently operating! So if the user has "activate when < 15%", and the device is at 100%, it'll still return true.Marlenamarlene

© 2022 - 2024 — McMap. All rights reserved.