From: Po Lu Date: Sun, 20 Aug 2023 13:40:08 +0000 (+0800) Subject: Repair desktop notification display on Android 2.3 and 2.2 X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=392d00e0aaf7f66eb8a3de9919ff8835bc63b355;p=emacs.git Repair desktop notification display on Android 2.3 and 2.2 * java/org/gnu/emacs/EmacsDesktopNotification.java (display1): Create a pending intent and set it as the contentIntent when building a notification by hand. --- 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 @@ package org.gnu.emacs; 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 @@ public final class EmacsDesktopNotification 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);