0
알람 신호가 있습니다. 경보를 두 번 이상 발동시키는 방법 및 각 경보에서? 하나의 알람 시계 만 작동하고 나머지는 덮어 씁니다.TaskReminer는 하나의 알람 만 작동합니다.
는코드 :
public class ReminderManager {
private Context mContext;
private AlarmManager mAlarmManager;
public ReminderManager(Context context) {
mContext = context;
mAlarmManager = (AlarmManager)context.getSystemService(Context.ALARM_SERVICE);
}
public void setReminder(Long taskId, Calendar when) {
if (when.getTimeInMillis() < System.currentTimeMillis()) {
return;
}
Intent i = new Intent(mContext, OnAlarmReceiver.class);
i.putExtra(DbAdapter.KEY_ROWID, (long)taskId);
PendingIntent pi = PendingIntent.getBroadcast(mContext, 0, i, PendingIntent.FLAG_ONE_SHOT);
mAlarmManager.set(AlarmManager.ELAPSED_REALTIME_WAKEUP, SystemClock.elapsedRealtime(), pi);
}
}
나는 문제가 requestCode가에 있음을 이해하지만, 나는 그것을 해결하는 방법을 이해할 수 없다 ..
이해합니다. 어떻게 해결할 수 있습니까? –
임의의 정수 생성 ... –
임의의 rand = 새로운 임의(); int n = rand.nextInt(); –