I want to pass extras with my pending intent when I set an alarm to be picked up by my receiver in onReceive and then passed on as extras in my receive intent to be picked up by my scheduling service to be included in my notification.
E.g. set an alarm to remind me to take a medicine with name 'x' in 'y' amount of time. I want the name 'x' to be displayed in the notification when the alarm is fired.
I found this answer very helpful.
However, in the Google Android sample project scheduler available from here, it advises that if your receiver intent includes extras that need to be passed along to the service, use setComponent() to indicate that the service should handle the receiver's intent:
ComponentName comp = new ComponentName(context.getPackageName(),
MyService.class.getName());
// This intent passed in this call will include the wake lock extra as well as
// the receiver intent contents.
startWakefulService(context, (intent.setComponent(comp)));
The answer I referenced does not do this.
Is it only required to use setComponent when the component from onReceive is a service and this is not required when the component is an activity?
Thanks, Sam.