Вопрос

У меня есть приложение, которое имеет аварийную систему, которая работает Flawlesly, и я копирую все 5 классов и просто измените имя базы данных, но оно не работает, я могу мимо вас весь код, но я хочу услышать, если кто-тобыло что-то вроде этого раньше.

Как я называю новый remindermanager (это) .setreminder (morowid, mcalendar);

ROWID заполнен (какой-то число) и Mcalendar (имеет дату, с которой я сравниваю с датой из mcalendar другого приложения, который у меня есть, и это тот же формат), и когда я называю это, все идет как это должноЭто творцы ожидающего намерения

public void  setReminder(Long taskId, Calendar when)
{
    Intent i= new Intent(mContext,OnAlarmReciver.class);
    i.putExtra(DatabaseIN.KEY_ROWID,(long)taskId);


    PendingIntent pi=PendingIntent.getBroadcast(mContext,0, i, PendingIntent.FLAG_ONE_SHOT);
    mAlarmManager.set(AlarmManager.RTC_WAKEUP,when.getTimeInMillis(),pi);

}
after this nothing happens... can anyone help
.

Это было полезно?

Решение

Try to clean ur project->clean and if that doesn't help create a new project and start writing the clases all over again.. that worked for me :D

Другие советы

Perhaps when has not happened yet (too far in the future) or it happened already (was in the past before your call to set()).

Or, perhaps you do not have OnAlarmReceiver defined in your manifest.

PendingIntent.getBroadcast will reuse a matching pendingIntent, so perhaps it has fired that pending intent already (e.g., possibly from the code you copied it from), and since you're using a FLAG_ONE_SHOT flag, it'll only ever fire once.

Quick test is to remove the FLAG_ONE_SHOT flag, and see if it fires. If that is the problem, then simply use a different request code in the PendingIntent.getBroadcast.

Лицензировано под: CC-BY-SA с атрибуция
Не связан с StackOverflow
scroll top