I am using the alarm manager to call a service at a later time where I want 
to update a file at a user specified time. That mechanism works fine. What 
i need to do now is pass to the service which alarm has called it as I have 
multiple alarms with different intents which needs to do different things 
at different times. 

I understand how to pass extras with bundles, but it doesnt seem to work 
with services. I cant pass anything to it this way, I keep getting null as 
what was passed from the activity to the service. 

Here is my activity code for 1 alarm.

Intent myIntent = new Intent(this, TimerService.class); Bundle bundle = new 
Bundle(); 
bundle.putString("extraData", "FIRST_ALARM"); 
myIntent.putExtras(bundle);     PendingIntent AmPendingIntent = 
PendingIntent.getService(this, 0, myIntent, 0); 
 AlarmManager am = (AlarmManager)getSystemService(ALARM_SERVICE); 
am.setRepeating(AlarmManager.RTC_WAKEUP, Time2fire, fONCE_PER_DAY, 
AmPendingIntent); 

 
Service Code:

super.onStart(intent, startId); String bundleFromActivity = 
intent.getStringExtra("extraData"); 

 
At this point my bundleFromActivity string is always null. Im sure this is 
a simple problem and im missing something about the services. Thanks in 
advance for any help.

-- 
You received this message because you are subscribed to the Google Groups 
"Android Discuss" group.
To view this discussion on the web visit 
https://groups.google.com/d/msg/android-discuss/-/fmYWeis9iBUJ.
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-discuss?hl=en.

Reply via email to