I\'m stuck with a little problem here.
I want my app to do something, but only when the battery is at 10%.
My app doesn\'t watch the battery level constantly;
In this case, you can use "ACTION_BATTERY_CHANGED"
public void onReceive(Context context, Intent intent) {
String action = intent.getAction();
if (Intent.ACTION_BATTERY_CHANGED.equals(action)) {
int level = intent.getIntExtra("level", 0);
int scale = intent.getIntExtra("scale", 100);
double batStatus = level * 100 / scale;
}
}
Hope this will help you.