BeeJayF
BeeJayF

Reputation: 195

Repeating alarm running in background for Android 14 and up

I am using code with the following key lines of code to implement a repeating alarm that can be set between 3 and 30 minutes. This worked with Android 12 and the app running in fore- and background and also with the phone sleeping. With Android 14 it will only work with the app in foreground and the screen on.

Intent myIntent = new Intent(this, MyBroadcastReceiver.class);
PendingIntent pendingIntent = PendingIntent.getBroadcast(this.getApplicationContext(), myRequestCode, myIntent, PendingIntent.FLAG_IMMUTABLE);
AlarmManager alarmManager = (AlarmManager) getSystemService(ALARM_SERVICE);
alarmManager.setRepeating(AlarmManager.ELAPSED_REALTIME_WAKEUP, 3000, reminderRate, pendingIntent);

The 1st alarm (after 3 secs) triggers even if I send to phone to sleep right after starting the repeating alarm but no follow up alarm will sound.

After checking a lot of documentation, I am out of ideas how to make this work.

Thanks for any help on this!

BeeJayF

Upvotes: 0

Views: 72

Answers (0)

Related Questions