I want to get location every 15 sec and everything is ok, but in doze mode(deep sleep) my handler not working, is anyway? AlarmManager is good way but the time limit is 1 min is not repeated in doze mode.
@ReactMethod
public static void setAlarm()
{
int interval = 50; // delay in secs
AlarmManager am = (AlarmManager) reactContext.getSystemService(Context.ALARM_SERVICE);
Intent intent = new Intent(reactContext, AlarmManagerReceiver.class);
PendingIntent pi = PendingIntent.getBroadcast(reactContext, 0, intent, 0);
am.setRepeating(AlarmManager.RTC_WAKEUP, System.currentTimeMillis(), interval*1000 , pi);
}
Receiver :
public class AlarmManagerReceiver extends BroadcastReceiver {
@Override
public void onReceive(Context context, Intent intent) {
DoRoutine();
}
}