android-notifications

Why do I get RemoteServiceException for creating/updating a notification?

陌路散爱 提交于 2019-12-03 12:54:39
Background I have a spare time app that I've been working on for some years ( here ), and I try to handle as many crashes as I can (I hate seeing crash reports!). The problem One recent crash that seem quite new, is this one: android.app.RemoteServiceException: at android.app.ActivityThread$H.handleMessage (ActivityThread.java:1768) at android.os.Handler.dispatchMessage (Handler.java:106) at android.os.Looper.loop (Looper.java:164) at android.app.ActivityThread.main (ActivityThread.java:6494) at java.lang.reflect.Method.invoke (Method.java) at com.android.internal.os.RuntimeInit

How to handle mixed RTL & LTR languages in notifications?

偶尔善良 提交于 2019-12-03 12:22:41
Background Android 4.3 has added a lot of support for RTL (Right-To-Left) languages, such as Hebrew and Arabic. The problem Even though there is "textDirection", "layoutDirection" and "gravity", I can't find the equivalents for the notification builder, not even in the compatibility library. This means that if there are Hebrew and English words together, the order is wrong. For example (and I write in English for simplicity) : Instead of "X called Y" , you get "Y called X" (suppose "called" is a word in Hebrew), as the string is supposed to be in this format: <string name="notification">%1$s

Android: Manage multiple push notification in device of an app

会有一股神秘感。 提交于 2019-12-03 11:53:16
问题 I am developing an application in which i implemented Push notification functionality. My code of onMessage - GCMIntentService.java is: @Override protected void onMessage(Context context, Intent data) { String message = data.getExtras().getString("message"); displayMessage(context, message); generateNotification(context, message); } And code of generateNotification - private static void generateNotification(Context context, String message) { int icon = R.drawable.ic_launcher; long when =

Android N notification title and icon color is darker

风流意气都作罢 提交于 2019-12-03 11:40:32
问题 When showing a notification in android N and O it shows like this You can change the top color of the icon and the app name by using setColor method of the NotificationCompat.Builder , The problem is that the displayed color doesn't match the provided one as it gets darker in the notification. I tested it on Google Pixel(Oreo). Is this documented somewhere? Any workarounds? 回答1: Google decided to restrict acceptable colors in Notification when using setColor. Yes, it's undocumented,

How to get Override Do not Disturb Settings Value?

我的未来我决定 提交于 2019-12-03 11:04:27
How do I get Override Do Not Disturb Settings state in Android for my own package app? The documentation is not very clear how to show this option, just that it's possible: On Android 8.0 (API level 26) and above, users can additionally allow notifications through for app-specific categories (also known as channels) by overriding Do Not Disturb on a channel-by-channel basis. [...] On devices running Android 7.1 (API level 25) and below, users can allow notifications through on an app by app basis, rather than on a channel by channel basis. But according to my testes, on Android 8.0+ you have

Bad Notification: Couldn't expand RemoteViews for: StatusBarNotification. on Android Nougat

扶醉桌前 提交于 2019-12-03 10:43:39
I use OneSignal SDK to show notifications. I do it in OneSignalPushService.java . OneSignalPushService.java: public class OneSignalPushService extends NotificationExtenderService { @Override protected boolean onNotificationProcessing(OSNotificationReceivedResult notification) { if (!TinyDbWrap.getInstance().isPushEnabled()) { KLog.d(this.getClass().getSimpleName(), "Notification will not displayed"); return true; } OverrideSettings overrideSettings = new OverrideSettings(); overrideSettings.extender = new NotificationCompat.Extender() { @Override public NotificationCompat.Builder extend

Notification created by IntentService uses always a wrong Intent

白昼怎懂夜的黑 提交于 2019-12-03 10:43:02
问题 Problem When the user presses Send "Button 1" (scroll down to see the construction of the app) a new Notification is created from the RefreshService . If the user presses this notification a MainActivity instance gets started and receives a String with the value Button 1 over the Intent. This value gets displayed. When the user presses now the Send "Button 2" a new Notification is created from the RefreshService . If the user presses this notification a MainActivity instance gets started and

Android O - Single line Notification - like the “Android System - USB charging this device”

不羁岁月 提交于 2019-12-03 10:41:11
问题 I would like to have an ongoing notification for my ForegroundService that requires as small place as possible. I like the "Android System - USB charging this device" style, but I cannot find any example how to achieve this. Can anyone point me in the right direction? Update The style is given to the notification if the channel is assigned the importance IMPORTANCE_MIN . It looks like there is no way to use Androids built in style for notifications of IMPORTANCE_MIN to be used with a

NavUtils.shouldUpRecreateTask fails on JellyBean

人盡茶涼 提交于 2019-12-03 10:38:54
I have an application that issues notifications that when selected start an activity. According to the Android docs I can use NavUtils.shouldUpRecreateTask to check whether the activity has been started directly (i.e. from the notification) or via a normal activity stack. However it gives the wrong answer. I'm testing this on JellyBean but using the support library. Basically shouldUpRecreateTask always returns false, even when the activity has been started form the notification. Any ideas on why shouldUpRecreateTask is failing to give the correct answer? This is not correct! When you start

Starting the app from Notification remove it from recent app history

末鹿安然 提交于 2019-12-03 10:13:02
I have a problem in one of my apps when I start it from a notification. It never appears in the "recent app" list. Without notifications, every thing works as expected: I start the app, navigate into and when I quit it (with home button or back button) after that I can go back into it with a long press on home button => ok. The problem starts when I receive a notification. If I start the app from the notification, it starts the correct screen and I can use the app => ok. But when I quit the app (with home or back button) it do not appears anymore in the "recent app" list. More precisely: If