Questions tagged [android-notifications]

A status notification adds an icon to the system's status bar (with an optional ticker-text message) and a notification message in the notifications window.

A notification is a user interface element that you display outside your app's normal UI to indicate that an event has occurred. Users can choose to view the notification while using other apps and respond to it when it's convenient for them.

Think of notifications as a news channel that alerts the user to important events as they happen or a log that chronicles events while the user is not paying attention. The user can expand the notification bar and by selecting the notification the user can trigger another activity. Notifications in Android are represented by the Notification class. To create notifications you use the NotificationManager class which can be received from the Activity via the getSystemService() method.

Useful links

4920 questions
13
votes
1 answer

Android: Notification stops updating once it has updated for a certain number of times on Kit-Kat

So I have a notification in my app. The notification has some text and an image which I fetch from a LruCache which I populate at the start. The problem is that on Kit-Kat devices (Moto E, XIomi) in my case, the notification stops updating if it has…
varunkr
  • 5,364
  • 11
  • 50
  • 99
13
votes
1 answer

Google now handles whatsapp messaging

I see there are many threads on How to send whatsApp message without opening WhatsApp? All the answers lead to either of these two options: Open whatsApp -> select contact. Message set in intent would be sent to that contact. Open whatsApp with…
naamadheya
  • 1,902
  • 5
  • 21
  • 28
13
votes
1 answer

Android 4.1.1 Build Stack for Activity when receiving a Notification with URI

Our app has different notifications that can open different Activities. So we created the URI scheme to do so. The Notifications are received and open the correct activities. I create the stack for proper navigation with the following code: Intent…
Franklin
  • 881
  • 1
  • 8
  • 28
13
votes
2 answers

NotificationListenerService not reading text of stacked notifications

I hope this doesn't violate any rule as I've tried following the How-to-ask guide. I'm trying to read incoming notifications using NotificationListenerService and it works for me but only partially. The first notification of it's type, lets say -…
Bended
  • 494
  • 1
  • 7
  • 22
13
votes
1 answer

Disable android wear pending intent action confirmation

I'm currently working on an app with notification which are shown on a wear device. The notification contains an action binded onto the notification card (.setContentAction(0)). Everything is working fine, except that it shows a confirmation…
Lukas
  • 2,544
  • 2
  • 18
  • 33
13
votes
3 answers

PendingIntent from second action overwrites the first action and the contentIntent for Notification

The code: int id = 0; NotificationCompat.Builder builder = new NotificationCompat.Builder(context) .setContentTitle(context.getString(R.string.notification_on_the_move_gps_title)) …
Saran
  • 3,845
  • 3
  • 37
  • 59
13
votes
6 answers

Android Notification.Builder: show a notification without icon

String ns = Context.NOTIFICATION_SERVICE; NotificationManager mNotificationManager = (NotificationManager) getSystemService(ns); int icon = R.drawable.ic_notification_icon; android.app.Notification.Builder nbuilder = new…
user1071138
  • 656
  • 3
  • 12
  • 30
12
votes
2 answers

Is there a straightforward way to stop a service in response to a user clicking a notification?

I'd like the following behavior: The user clicks a notification and Android stops my Service. The problem is that stopping a Service requires a call to stopService and I cannot easily create a PendingIntent that does that. So the only way I found to…
gregm
  • 12,019
  • 7
  • 56
  • 78
12
votes
2 answers

RemoteServiceException when notification style is applied on Xiaomi phones with Android 11

Without any visible reason, Xiaomi phones with Android 11 started to appear in crashlytics logs. Something happens with notifications. We don't do anything too specific and everything works fine on other Android 11 devices. I wasn't able to…
12
votes
1 answer

Flutter Background task at midnight everyday to process and schedule notifications for said day

APPLICATION: Task reminders. The user creates a task and schedules when this task is due. This package flutter_local_notification allows me to schedule a future notification to the user when they create this task. Which is fine if I schedule one…
12
votes
1 answer

An implicit deep link from a notification in JetpackNavigation library

I'm trying to implement an implicit deep link handling in my application, but the following code doesn't work out and onNewIntent in my single activity isn't calling, but always startDestination from navigation graph is opening. In my navigation…
12
votes
4 answers

Notification coloured action button Android 10

I'm trying to color the buttons(Action) in Notification like this. So far this is what i'm achieved so far. Below is the code i'm using NotificationService.class private void showCallNotification(Map dataMap) { …
Shahal
  • 1,008
  • 1
  • 11
  • 29
12
votes
2 answers

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

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…
12
votes
1 answer

Android Oreo Does not Play Custom Sound for Notification

I am trying to add a custom sound to notification for API > 26. Below is the code NotificationChannel notificationChannel = new NotificationChannel("channel id","channel…
12
votes
2 answers

Receiving broadcast from notification on Android Oreo

I have a custom button in a sticky notification. I used to attach a PendingIntent to it for receiving button clicks: Intent intent = new Intent(); intent.setAction("com.example.app.intent.action.BUTTON_CLICK"); PendingIntent pendingIntent =…