Forum Xamarin.Android
We are excited to announce that the Xamarin Forums are moving to the new Microsoft Q&A experience. Q&A is the home for technical questions and answers at across all products at Microsoft now including Xamarin!

We encourage you to head over to Microsoft Q&A for .NET for posting new questions and get involved today.

Alarm manager problem in Android 6.0

I use the AlarmManager in my Android app to send notifications periodically. It works like a charm in versions before Android 6.0. But in Android 6.0 it does not send the notifications anymore.

Now I've read some articles mentioning that Android 6.0 is restricting apps more when the device is not used actively. Does anyone here experience the same problem with alarms?

The app is implemented in F# and this is the code that actually sets an alarm:

        let alarmManager = context.GetSystemService(Context.AlarmService) :?> AlarmManager
        let intent = new Intent(context, this.Class)
        let pi = PendingIntent.GetBroadcast(context, 0, intent, PendingIntentFlags.UpdateCurrent)
        alarmManager.Cancel(pi)

        //TODO: in android 6.0 this seems to cause problems does not work
        alarmManager.SetRepeating(AlarmType.ElapsedRealtimeWakeup, (int64) 0, AlarmManager.IntervalFifteenMinutes, pi)

Best Answer

Answers

Sign In or Register to comment.