【发布时间】:2012-01-24 12:40:52
【问题描述】:
我想每 10 分钟设置一次闹钟。但它是第一次运行,只有任何机构好心帮助我
Intent intent = new Intent(this, ConnectionReceiver.class);
PendingIntent pendingIntent = PendingIntent.getBroadcast(this, 0,
intent, PendingIntent.FLAG_ONE_SHOT);
AlarmManager alarmManager = (AlarmManager) getSystemService(ALARM_SERVICE);
alarmManager.set(AlarmManager.RTC_WAKEUP, System.currentTimeMillis() + (1 * 1000), pendingIntent);
Toast.makeText(this, "Alarm set", Toast.LENGTH_LONG).show();//every 10 minutes i want to print the toast
【问题讨论】:
-
将 (1 * 1000) 替换为 (10 * 60 * 1000) 您在代码中为 alarmManager 设置的位置。