Nilanka Manoj
Nilanka Manoj

Reputation: 3728

check whether android device in maintenance window

I want to check whether device is in a maintenance window of doze mode.

so I used :

//on receive alarm broadcast
PowerManager pm = (PowerManager) context.getSystemService(Context.POWER_SERVICE);
boolean isDeviceIdleMode = pm.isDeviceIdleMode();
//do work

but realized that it returned false always.

After referring to documentation, I found that,

it will return false if the device is in a long-term idle mode but currently running a maintenance window where restrictions have been lifted.

Is there a method like isDeviceInMaintenanceWindow or how can I programmatically detect it?

Upvotes: 1

Views: 369

Answers (0)

Related Questions