Let's say I have a background service that performs several tasks.
As it completes task A, it posts notification A with a certain intent
and some extra data that indicates viewing result of A.
As it completes task B, it posts notification B with a certain intent
and some extra data that indicates viewing result of B.
As it completes task C, it posts notification C with a certain intent
and some extra data that indicates viewing result of C.
At the end, the notification area has three notifications. Each one
has the same intent, except for one of the extra data fields.
I would expect that each one would load my activity with different
extra data. They don't.
When onNewIntent is called, each has the extra data field set to C. I
have rooted out any possible aliasing and checked the data as it is
placed into a notification. It seems to allow only one set of data
per
package.
Is what I am attempting not possible? Has anyone accomplished what I
am attempting? For example, have you had a service download several
large files, and then had notifications that would open each of those
files?
This is some of the relevant code:
                        // post a finished notification.
                        Notification finished = new
Notification(R.drawable.notifier,
                                        tickerText,
System.currentTimeMillis());
                        Intent intent = new Intent();
                        intent.setClass(DownloadService.this,
MyActivity.class);
                        intent.setAction(MyActivity.OPEN_LOCATION);
                        // adding parameters to extras
......
                        intent.putExtra("packageName.layer", layer);
.......
                        // The PendingIntent to launch our activity if
the user selects
this
                        // notification
                        PendingIntent contentIntent =
PendingIntent.getActivity(DownloadService.this, 0,
                                        intent,
PendingIntent.FLAG_ONE_SHOT |
PendingIntent.FLAG_UPDATE_CURRENT | Intent.FILL_IN_DATA);
                        String contentTitle =
getString(R.string.n_download_completed);
                        String contentText =
getString(R.string.n_download_results, layer);
 
finished.setLatestEventInfo(DownloadService.this, contentTitle,
contentText,
                                        contentIntent);
                        mNotificationManager.notify(finishedid++,
finished);
Nathan
--
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-
develop...@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Reply via email to