Skip to content
This repository has been archived by the owner on Sep 4, 2020. It is now read-only.

Commit

Permalink
Issue #610: Android: notification does not dismiss after selection bu…
Browse files Browse the repository at this point in the history
…tton (1.6.x dev)
  • Loading branch information
macdonst committed Mar 1, 2016
1 parent 54d6cab commit 2a7d414
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
6 changes: 4 additions & 2 deletions src/android/com/adobe/phonegap/push/GCMIntentService.java
Original file line number Diff line number Diff line change
Expand Up @@ -322,12 +322,12 @@ public void createNotification(Context context, Bundle extras) {
/*
* Notification add actions
*/
createActions(extras, mBuilder, resources, packageName);
createActions(extras, mBuilder, resources, packageName, notId);

mNotificationManager.notify(appName, notId, mBuilder.build());
}

private void createActions(Bundle extras, NotificationCompat.Builder mBuilder, Resources resources, String packageName) {
private void createActions(Bundle extras, NotificationCompat.Builder mBuilder, Resources resources, String packageName, int notId) {
Log.d(LOG_TAG, "create actions");
String actions = extras.getString(ACTIONS);
if (actions != null) {
Expand All @@ -345,12 +345,14 @@ private void createActions(Bundle extras, NotificationCompat.Builder mBuilder, R
intent.putExtra(CALLBACK, action.getString(CALLBACK));
intent.putExtra(PUSH_BUNDLE, extras);
intent.putExtra(FOREGROUND, foreground);
intent.putExtra(NOT_ID, notId);
pIntent = PendingIntent.getActivity(this, i, intent, PendingIntent.FLAG_UPDATE_CURRENT);
} else {
intent = new Intent(this, BackgroundActionButtonHandler.class);
intent.putExtra(CALLBACK, action.getString(CALLBACK));
intent.putExtra(PUSH_BUNDLE, extras);
intent.putExtra(FOREGROUND, foreground);
intent.putExtra(NOT_ID, notId);
pIntent = PendingIntent.getBroadcast(this, i, intent, PendingIntent.FLAG_UPDATE_CURRENT);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ public class PushHandlerActivity extends Activity implements PushConstants {
@Override
public void onCreate(Bundle savedInstanceState) {
GCMIntentService gcm = new GCMIntentService();
int notId = getIntent().getIntExtra(NOT_ID, 0);
int notId = getIntent().getExtras().getInt(NOT_ID, 0);
Log.d(LOG_TAG, "not id = " + notId);
gcm.setNotification(notId, "");
NotificationManager notificationManager = (NotificationManager) getSystemService(Context.NOTIFICATION_SERVICE);
Expand Down

0 comments on commit 2a7d414

Please sign in to comment.