Domanda

Ho un'applicazione che ha un sistema di allarme che funziona flawlesly e io copiano tutte le classi 5 e basta modificare il nome del database, ma non funziona, posso passare tutto il codice ma voglio sentire se qualcunoha avuto qualcosa del genere prima.

Come chiamo New Remdermanager (questo) .Setreminder (MrOWid, McAlendar);

La Rowid è piena (un certo numero) e il McAlendar (ha una data che mi confronto con la data dal McAlendar dell'altra app che ho ed è lo stesso formato) e quando lo chiamo tutto ciò che dovrebbeCreatese l'intento in sospeso

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
.

È stato utile?

Soluzione

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

Altri suggerimenti

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.

Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top