AlarmManager不精确重复警报永远不会触发(Xamarin android)

时间:2017-01-13 18:57:33

标签: android xamarin

接收者的onReceive永远不会运行

adb shell dumpsys alarm 显示警报未设置

设置闹钟的代码(此代码已运行):

        Intent i = new Intent(context, typeof(UpdateTask));
        PendingIntent pi = PendingIntent.GetService(context, 0, i, 0);

        AlarmManager alarmMgr = (AlarmManager)context.GetSystemService(Context.AlarmService);
        alarmMgr.SetInexactRepeating(AlarmType.RtcWakeup,
            SystemClock.ElapsedRealtime(),
            60 * 1000, pi);

应该启动的BroadcastReceiver定义如下:

[BroadcastReceiver]
class UpdateTask : BroadcastReceiver {
    public override void OnReceive(Context context, Intent intent) {
        [...]

0 个答案:

没有答案