Hello,
Please see the following code. It could not pass those extra
parameters to the intent.
When I tried show the keys in the intent, it only gets the key
"android.intent.extra.ALARM_COUNT".
Anything I did wrong?
Please teach me how can I pass some parameters to the AlarmService
when the alarm activate?
Best regards,
Eric
AlarmManager alarmManager =
(AlarmManager)getSystemService(ALARM_SERVICE);
Intent myIntent = new Intent(this, TVAlarmService.class);
PendingIntent pendingIntent = PendingIntent.getService(Main.MAIN, 0,
myIntent, PendingIntent.FLAG_UPDATE_CURRENT);
myIntent.putExtra("name", lValue);
myIntent.putExtra("program", program);
myIntent.putExtra("today", today);
alarmManager.set(AlarmManager.RTC_WAKEUP, calendar.getTimeInMillis(),
pendingIntent);
=======================================================================
public class MyAlarmService extends Service {
@Override
public void onStart(Intent intent, int startId) {
Bundle extras = intent.getExtras();
for(String k : extras.keySet()) {
Log.i(TAG, "key >>>>>>> " + k);
}
}
--
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en