how can we pass the value to receiver...i am using alarm manager...
+1
A:
Use a PeningIntent, whose Intent has bundled extras.
This is modified from the AlarmController Google APIDemo:
Intent intent = new Intent(AlarmController.this, RepeatingAlarm.class);
intent.putExtra("some_name", some_value);
PendingIntent sender = PendingIntent.getBroadcast(AlarmController.this,
0, intent, 0);
// We want the alarm to go off 30 seconds from now.
long firstTime = SystemClock.elapsedRealtime();
firstTime += 15*1000;
// Schedule the alarm!
AlarmManager am = (AlarmManager)getSystemService(ALARM_SERVICE);
am.setRepeating(AlarmManager.ELAPSED_REALTIME_WAKEUP,
firstTime, 15*1000, sender);
Then retrieve those in your Receiver's onReceive():
intent.getStringExtra("some_name")
iPaulPro
2010-09-07 04:51:08
ok i am using alarm manager...it will be scheduled...if the device was rebooted...can the alarm activity correctly process that schedule?
Kandhasamy
2010-09-07 04:59:43
Unfortunately not. You will need to set a reboot listener, like this: http://www.tutorialforandroid.com/2009/07/permissions-journey-receivebootcomplete.html
iPaulPro
2010-09-07 05:05:12