I have a widget and 4 buttons on it. The buttons are actually shortcuts to other applications. I’ve set an onClick pending intent for each of the buttons with this code:
Intent i = context.getPackageManager().getLaunchIntentForPackage(s);
PendingIntent pi = PendingIntent.getActivity(context, 0, i, Intent.FLAG_ACTIVITY_NEW_TASK);
remoteViews.setOnClickPendingIntent(curIconId, pi);
Usually it works fine, but sometimes it doesn’t do anything and in the logcat I see a SendIntentException with the message “Cannot send pending intent”.
If I update the widget (i.e. setting the pending intent again), it works fine again.
Any ideas on why it breaks down sometimes?
Thanks
The problem was that I sent too much data to the remote views (in my case, too many icons). So the update actually failed. There is a size limit on what you can send, don’t remember where I read it.
The solution in my case was to update the images with resource URLs instead of the actual images.