0

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();
}}
Intathep
  • 3,378
  • 2
  • 21
  • 28

1 Answers1

1

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

Community
  • 1
  • 1
davehale23
  • 4,374
  • 2
  • 27
  • 40
  • You can fire off your alarms in the BroadcastReceiver if you want – davehale23 Feb 17 '12 at 05:23
  • please check my question again – Intathep Feb 17 '12 at 05:27
  • You cannot start an Activity in the BroadcastReceiver onReceive when the phone is booting. You can start a Service that will start your alarms. See more about that here --> http://developer.android.com/resources/samples/ApiDemos/src/com/example/android/apis/app/LocalService.html – davehale23 Mar 19 '12 at 19:52