Forum Xamarin.Android

AlarmManager is not firing the operation at fix interval


I am working in the application where I have to invoke a method repeatedly after fix interval. I am using AlarmManager class for it.

var myReceiver = new MyReceiver ();
RegisterReceiver (myReceiver, new IntentFilter ("my_receiver"));

var myIntent = new Intent ("my_receiver");
PendingIntent myPendingIntent = PendingIntent.GetBroadcast (this, 0, myIntent, 0);

var myAlarmManager = (AlarmManager)GetSystemService (Context.AlarmService);
myAlarmManager.SetRepeating (AlarmType.ElapsedRealtimeWakeup, SystemClock.ElapsedRealtime (), 1000, myPendingIntent);

The method does not fire after one second, it fires after a large delay of 10-15 seconds.
Same code works fine in native Android Environment. What is the cause of the problem?

Sign In or Register to comment.