Intathep
Intathep

Reputation: 3388

android : all of alarm were cleared how to get them back

first of all , i would like to apologize for my English its bad

all of alarm that i create by this class

    Intent intent = new Intent(SETALARM.this, ALARMRECEIVER.class);
    intent.putExtra("pk", pk);
    sender = PendingIntent.getBroadcast(this, pk, intent, PendingIntent.FLAG_CANCEL_CURRENT);
    am = (AlarmManager) getSystemService(ALARM_SERVICE); 
    am.setRepeating(AlarmManager.RTC_WAKEUP, calendar.getTimeInMillis(),60000, sender);

were cleared when device is shut off

what should i do to restore all of alarm back

thank you very much for your help

edit

here is receiver class

@Override
public void onReceive(Context context, Intent intent) {         
    WakeLocker.acquire(context);   


    pk = Integer.parseInt(intent.getExtras().get("pk").toString());     
    Intent intent2 = new Intent(context,ALERT.class);
    intent2.putExtra("pk", pk);
    intent2.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
    context.startActivity(intent2); 

    WakeLocker.release();
}}

Upvotes: 0

Views: 156

Answers (1)

davehale23
davehale23

Reputation: 4372

If you mean that you lose the alarms when the device is turned off then this issue has been addressed well here https://stackoverflow.com/a/5439320/374866

Upvotes: 1

Related Questions