1
私が見て、このリンクを使用開始:Creating And Scheduling Alarms Using AlarmManager In Androidは、AndroidでAlarmManager(C#の)
今私はこのコードを持っている:
namespace AlarmManage
{
public class MyBroadcastReceiver : BroadcastReceiver
{
public override void OnReceive(Context context, Intent intent)
{
Toast.MakeText(context, "Time Up... Now Vibrating !!!",
ToastLength.Long).Show();
Vibrator vibrator = (Vibrator)context
.GetSystemService(Context.VibratorService);
vibrator.Vibrate(2000);
}
}
}
public void startAlertAtParticularTime()
{
// alarm first vibrate at 14 hrs and 40 min and repeat itself at ONE_HOUR interval
intent = new Intent(this, typeof(MyBroadcastReceiver));
pendingIntent = PendingIntent.GetBroadcast(
this, 280192, intent, PendingIntentFlags.CancelCurrent);
Java.Util.Calendar calendar = Java.Util.Calendar.Instance;
calendar.TimeInMillis = Java.Lang.JavaSystem.CurrentTimeMillis();
calendar.Set(Java.Util.CalendarField.HourOfDay, 14);
calendar.Set(Java.Util.CalendarField.Minute, 49);
alarmManager = (AlarmManager)GetSystemService(AlarmService);
alarmManager.SetRepeating(AlarmType.RtcWakeup, calendar.TimeInMillis,
AlarmManager.IntervalHour, pendingIntent);
Toast.MakeText(this, "Alarm will vibrate at time specified", ToastLength.Long).Show();
}
を私はまた、マニフェストに "-アラームを設定" と "VIBRATE" に設定。
私の問題:私は出力が表示されない「タイムアップ...今、振動!!!