PendingIntent works correctly for the first notification but incorrectly for the rest

Worked when added these:

  1. intent.setAction(Long.toString(System.currentTimeMillis()));

 

PackageManager pm = context.getPackageManager();

    Intent intent = new Intent(context, MyOwnActivity.class);
    intent.putExtra("foo_bar_extra_key", "foo_bar_extra_value");
    intent.setAction(Long.toString(System.currentTimeMillis()));
    PendingIntent pendingIntent = PendingIntent.getActivity(context, 0,
            intent, PendingIntent.FLAG_UPDATE_CURRENT);
    RemoteViews views = new RemoteViews(context.getPackageName(),
            R.layout.widget_layout);
    views.setOnClickPendingIntent(my_button_r_id_received_in_parameter, pendingIntent);
Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s