Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

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.

like image 972
Dominik Mičuta Avatar asked Sep 17 '13 08:09

Dominik Mičuta


2 Answers

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.

like image 89
mldeveloper Avatar answered Oct 28 '22 14:10

mldeveloper


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)

like image 27
mobo Avatar answered Oct 28 '22 14:10

mobo