RESOLVED: Communication between a service and an...

Put your problem here if it does not fit any of the other categories.

RESOLVED: Communication between a service and an...

Postby rdomloge » Wed Jun 24, 2009 2:43 pm

I have a service which has an Activity UI. The UI shows the progress of the service and schedules work for it.

As a result, the user can dismiss the Activity/UI and do other work whilst the service continues in the background.

When the service has an issue and requires input, it can only communicate with the user via the notifications bar.

I have managed to get it so that the notification will bring up the Activity/UI when you click a notification from the service, but the extras which the service put into the intent to create the notification are missing from the intent obtained in the activity's onResume() method when you call getIntent().

Can anyone tell me how the service can create a notification in the task bar which contains extra information so that when the user clicks the notification, the activity starts and can interrogate the intent to find out WHAT the issue is and ask the user the correct question, so that it can send the service the correct reply?

Thanks in advance!
Last edited by rdomloge on Thu Jun 25, 2009 5:04 pm, edited 1 time in total.
rdomloge
Junior Developer
Junior Developer
 
Posts: 24
Joined: Sat Jan 24, 2009 2:11 pm

Top

Further info

Postby rdomloge » Wed Jun 24, 2009 5:02 pm

I have discovered that when my Activity UI is set to 'singleTop' or 'singleInstance' clicking on the notification brings up the original instance of the Activity, without updating the intent that created it. Thus the info that was included in the notification is lost.

If I set the Launch Mode of the Activity to 'standard', when the user clicks the notification a new Activity is created with the additional info from the notification's intent. Whilst this works well, it's undesirable since I have two instances of my Activity running and once the user closes the first one, they are faced with a mirror instance.

So... can anyone tell me how to get to the notification's intent, when an existing Activity is brought to the front which was created by a previous intent?
rdomloge
Junior Developer
Junior Developer
 
Posts: 24
Joined: Sat Jan 24, 2009 2:11 pm

Top

Return to Other Coding-Problems

Who is online

Users browsing this forum: No registered users and 17 guests