diff options
| author | Po Lu | 2023-08-20 21:40:08 +0800 |
|---|---|---|
| committer | Po Lu | 2023-08-20 21:40:08 +0800 |
| commit | 392d00e0aaf7f66eb8a3de9919ff8835bc63b355 (patch) | |
| tree | 3e04fdf77119edb5a5cb93a008e85d3d16510844 /java | |
| parent | 5734c57851e23ee34357b8c5eae8ea89c2dc5037 (diff) | |
| download | emacs-392d00e0aaf7f66eb8a3de9919ff8835bc63b355.tar.gz emacs-392d00e0aaf7f66eb8a3de9919ff8835bc63b355.zip | |
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.
Diffstat (limited to 'java')
| -rw-r--r-- | java/org/gnu/emacs/EmacsDesktopNotification.java | 12 |
1 files changed, 12 insertions, 0 deletions
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; | |||
| 22 | import android.app.Notification; | 22 | import android.app.Notification; |
| 23 | import android.app.NotificationManager; | 23 | import android.app.NotificationManager; |
| 24 | import android.app.NotificationChannel; | 24 | import android.app.NotificationChannel; |
| 25 | import android.app.PendingIntent; | ||
| 25 | 26 | ||
| 26 | import android.content.Context; | 27 | import android.content.Context; |
| 28 | import android.content.Intent; | ||
| 27 | 29 | ||
| 28 | import android.os.Build; | 30 | import android.os.Build; |
| 29 | 31 | ||
| @@ -87,6 +89,8 @@ public final class EmacsDesktopNotification | |||
| 87 | Notification notification; | 89 | Notification notification; |
| 88 | Object tem; | 90 | Object tem; |
| 89 | RemoteViews contentView; | 91 | RemoteViews contentView; |
| 92 | Intent intent; | ||
| 93 | PendingIntent pending; | ||
| 90 | 94 | ||
| 91 | tem = context.getSystemService (Context.NOTIFICATION_SERVICE); | 95 | tem = context.getSystemService (Context.NOTIFICATION_SERVICE); |
| 92 | manager = (NotificationManager) tem; | 96 | manager = (NotificationManager) tem; |
| @@ -127,6 +131,14 @@ public final class EmacsDesktopNotification | |||
| 127 | title); | 131 | title); |
| 128 | contentView.setTextViewText (R.id.sdk8_notifications_content, | 132 | contentView.setTextViewText (R.id.sdk8_notifications_content, |
| 129 | content); | 133 | content); |
| 134 | |||
| 135 | /* A content intent must be provided on these old versions of | ||
| 136 | Android. */ | ||
| 137 | |||
| 138 | intent = new Intent (context, EmacsActivity.class); | ||
| 139 | intent.addFlags (Intent.FLAG_ACTIVITY_NEW_TASK); | ||
| 140 | pending = PendingIntent.getActivity (context, 0, intent, 0); | ||
| 141 | notification.contentIntent = pending; | ||
| 130 | } | 142 | } |
| 131 | 143 | ||
| 132 | manager.notify (tag, 2, notification); | 144 | manager.notify (tag, 2, notification); |