diff --git a/java/org/gnu/emacs/EmacsDesktopNotification.java b/java/org/gnu/emacs/EmacsDesktopNotification.java index 8f55ffe8145..b73ef1022fa 100644 --- a/java/org/gnu/emacs/EmacsDesktopNotification.java +++ b/java/org/gnu/emacs/EmacsDesktopNotification.java @@ -22,8 +22,10 @@ import android.app.Notification; import android.app.NotificationManager; import android.app.NotificationChannel; +import android.app.PendingIntent; import android.content.Context; +import android.content.Intent; import android.os.Build; @@ -87,6 +89,8 @@ public final class EmacsDesktopNotification Notification notification; Object tem; RemoteViews contentView; + Intent intent; + PendingIntent pending; tem = context.getSystemService (Context.NOTIFICATION_SERVICE); manager = (NotificationManager) tem; @@ -127,6 +131,14 @@ else if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB) title); contentView.setTextViewText (R.id.sdk8_notifications_content, content); + + /* A content intent must be provided on these old versions of + Android. */ + + intent = new Intent (context, EmacsActivity.class); + intent.addFlags (Intent.FLAG_ACTIVITY_NEW_TASK); + pending = PendingIntent.getActivity (context, 0, intent, 0); + notification.contentIntent = pending; } manager.notify (tag, 2, notification);