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
2
votes
1 answer

Unable to unlock screen pattern/pin lock on notification arrival in Android app

I am making an Android hybrid application in which my requirements are that as soon as a notification arrives, my app should open and disable all locks. I tried using KeyguardManager(deprecated) but it's working on some devices only. Basically below…
2
votes
1 answer

Android/MIUI Setting small icon in notification bar not working? Default icon displayed

Tried every possibility to set small icon in status bar(which would get carried on by system as large icon in opened notification drawer) but nothing is working. Tried using raw .png file as well as drawable .xml files and combination of both(xml's…
ilmash
  • 174
  • 2
  • 12
2
votes
0 answers

Refresh Text in Notification (Remote View) Using Broadcast Receiver

I have looked all around and can not find a way to overwrite an existing Remote View TextView using a Broadcast Receiver. I'm trying to get the Remote View inside my MainActivity and update it with a new value to be displayed inside the notification…
2
votes
2 answers

Android AccesibilityService not receiving events

I have been hitting a wall with this problem for some time: This Accesibility Service reads notifications and process them. At first it worked succesfully on my phone (Moto G4) but then it wouldn't work on any smartphone, even tho this very same…
2
votes
1 answer

How to close previous activity after the notification is clicked and opens a new activity

I'm trying to work with the notification in android, and what I want to happen is that whenever I click the notification it will open the new activity, and will automatically close the activity I was previous on. I tried adding some flags but it…
2
votes
3 answers

Exception when recieving notification

when i receive a notification, my app crashes, here is my code to handle the notification : Firebase message Service: public class MyFirebaseMessagingService extends FirebaseMessagingService { private static final String TAG = "FCM Service"; …
2
votes
1 answer

Android 7.0/API24: How to check for notification access (Settings.Secure.enabled_notification_listeners)

In Android 6.0/API23 and earlier, the following used to work: String settingEnabled = android.provider.Settings.Secure.getString(this.getContentResolver(), "enabled_notification_listeners"); In Android 7.0 Nougat/API24 this seems to be no longer…
powerbar
  • 323
  • 3
  • 14
2
votes
1 answer

Notification does not open correct activity

I am using Firebase Cloud Messaging and I have my own class that extends FirebaseMessagingService.My activities order are as follows: SplashActivity -> MainActivity -> DetailsActivity . When the app is in the MainActivity and I send a message using…
2
votes
1 answer

Does Android provide a callback when the clear button on notifications list is clicked

Does Android provide a callback when the clear button on the notification list is clicked ? My app needs to clear some data whenever the notification is clicked or cleared. On clicking I know what to do, but how do I handle the second case ?
pankajagarwal
  • 13,462
  • 14
  • 54
  • 65
2
votes
0 answers

Android notification setAutoCancel() won't work when using setPrimaryClip() in BroadcastReceiver

I have encountered a strange behavior trying to make a very simple app. I'm firing a notification and when the user clicks on it I copy some random text to the clipboard. Here's how I fire the notification: // Build notification NotificationManager…
Andres
  • 6,080
  • 13
  • 60
  • 110
2
votes
1 answer

Send a notification with android at an interval

I'm trying to set a notification to appear after a certain interval. I expected this to work however nothing seems to happen when running the code on my phone other than at reciever being printed to the console and I can't seem to find out why. Any…
Sjw
  • 21
  • 2
2
votes
1 answer

Loading a Notification Big Picture using FCM

As the title says i want to use the FCM to send a payload and load a bitmap to use it in the Notification Big picture. I tried this method (Code is below) to get the image, but it didn't worked. Any help is much appreciated Thank you String…
Sasi Kanth
  • 709
  • 8
  • 17
2
votes
1 answer

How to cancel notification when click action

I have a notification that have an action "Open Dial". I want when I click on "Open dial" action. My notification will disappear and Dial will appear. I tried setAutocancel(true) and set notification.flags = Notification.FLAG_AUTO_CANCEL but these…
2
votes
1 answer

How to show a single notification icon in the status bar for multiple notifications

I'm currently showing notification with this: NotificationCompat.Builder noBuilder = new NotificationCompat.Builder(this) .setSound(sound) .setSmallIcon(R.drawable.h) .setLargeIcon(largeIcon) .setContentTitle(title) …
felix
  • 651
  • 1
  • 6
  • 12
2
votes
1 answer

Notification automatically opens up without any click

Notification opens up as soon as it is posted, not needing any action from the user. Here is my code: private void sendNotification(String message,String title,String id,String book) { smLocalStore=new SMLocalStore(this); Intent intent = new…
felix
  • 651
  • 1
  • 6
  • 12