I would like to show a notification that displays the progress of an
ongoing operation, but at the same time the remote view should contain
a cancel button to stop the ongoing operation.

I have to specify a contentIntent that is launched when clicking on
the notification: If I don't specify that I get something along those
lines:

E/ActivityManager(   62): Activity Manager Crash
E/ActivityManager(   62): java.lang.IllegalArgumentException:
contentIntent required: pkg=com.newsrob id=999
notification=Notification(vibrate=null,sound=null,defaults=0x0)
E/ActivityManager(   62):       at
com.android.server.NotificationManagerService.enqueueNotificationWithTag(NotificationManagerService.java:635)
E/ActivityManager(   62):       at
com.android.server.NotificationManagerService.enqueueNotification(NotificationManagerService.java:610)
E/ActivityManager(   62):       at
com.android.server.am.ServiceRecord.postNotification(ServiceRecord.java:256)
E/ActivityManager(   62):       at
com.android.server.am.ActivityManagerService.setServiceForeground(ActivityManagerService.java:10971)
E/ActivityManager(   62):       at
android.app.ActivityManagerNative.onTransact(ActivityManagerNative.java:596)
E/ActivityManager(   62):       at
com.android.server.am.ActivityManagerService.onTransact(ActivityManagerService.java:1539)
E/ActivityManager(   62):       at 
android.os.Binder.execTransact(Binder.java:287)
E/ActivityManager(   62):       at dalvik.system.NativeStart.run(Native Method)

For the "cancel" button I set another intent:

Intent cancelSyncIntent = new Intent("com.newsrob.CANCEL_SYNC");
                contentView.setOnClickPendingIntent(R.id.cancel_sync,
PendingIntent.getBroadcast(context, 0,
                                cancelSyncIntent, 0));

But this never works. I always get the content intent when the button
is clicked. It looks like I cannot use buttons in remote views of
notifications?!

I could probably display a text: "<< Press to cancel operation >>",
but that seems very heavy handed.

-- 
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

To unsubscribe from this group, send email to 
android-developers+unsubscribegooglegroups.com or reply to this email with the 
words "REMOVE ME" as the subject.

Reply via email to