Questions tagged [notifications]

A notification is a user interface element displayed to indicate an event has occurred.

A notification is a user interface element displayed to indicate an event has occurred.

Notifications typically occur in a designated area of an application's UI, such as an icon appearing in a status bar or an alert message.

15974 questions
138
votes
7 answers

Android notification doesn't disappear after clicking the notification

If got some issues with a notification I want to show in the notification bar. Although I set the notification flag to Notification.DEFAULT_LIGHTS & Notification.FLAG_AUTO_CANCEL the notification doesn't disappear after clicking it. Any ideas what…
Flo
  • 27,355
  • 15
  • 87
  • 125
137
votes
12 answers

Open application after clicking on Notification

I have a notification in my app with the following code: //Notification Start notificationManager = (NotificationManager) getSystemService(Context.NOTIFICATION_SERVICE); int icon = R.drawable.n1; CharSequence tickerText = "Call…
Reza_Rg
  • 3,345
  • 7
  • 32
  • 48
131
votes
5 answers

Remove notification after clicking

I want that the notification will be closed after the user is clicking on it. I saw that everybody saying to use flags, but I can't find the flags anywhere because I'm using NotificationCompat.Builder class and not Notification class. Someone have…
Yossi Zloof
  • 1,609
  • 3
  • 13
  • 13
126
votes
7 answers

Uri to default sound notification?

I use the Notification.Builder to build a notification. Now I want to use the default sound notification with: builder.setSound(Uri sound) But where is the Uri to the default notification?
StefMa
  • 3,344
  • 4
  • 27
  • 48
115
votes
5 answers

Ask for User Permission to Receive UILocalNotifications in iOS 8

I have set up local notifications in the App Delegate Using this: - (void)applicationDidEnterBackground:(UIApplication *)application { UILocalNotification *notification = [[UILocalNotification alloc]init]; [notification setAlertBody:@"Watch…
dannysandler
  • 1,881
  • 4
  • 16
  • 14
113
votes
19 answers

How to display multiple notifications in android

I am receiving only one notification and if there comes another notification, it replaces the previous one and here is my code private static void generateNotification(Context context, String message, String key) { int icon =…
Kartheek Sarabu
  • 3,886
  • 8
  • 33
  • 66
112
votes
5 answers

Sending a notification from a service in Android

I have a service running, and would like to send a notification. Too bad, the notification object requires a Context, like an Activity, and not a Service. Do you know any way to by pass that ? I tried to create an Activity for each notification but…
Bite code
  • 578,959
  • 113
  • 301
  • 329
111
votes
17 answers

How to clear a notification in Android

Is it possible to clear a notification programatically? I tried it with the NotificationManager but its not working. Is there any other way I can do it?
rahul
  • 1,139
  • 2
  • 8
  • 4
106
votes
7 answers

How to add button to notifications in android?

My app plays music and when users open notifications screen by swiping from the top of the screen ( or generally from the bottom right of the screen on tablets ), I want to present them a button to stop the currently playing music and start it again…
frankish
  • 6,738
  • 9
  • 49
  • 100
105
votes
11 answers

How exactly to use Notification.Builder

I found that I am using a deprecated method for noficitations (notification.setLatestEventInfo()) It says to use Notification.Builder. How do I use it? When I try to create a new instance, it tells me: Notification.Builder cannot be resolved to a…
Saariko
  • 1,703
  • 4
  • 26
  • 46
105
votes
10 answers

No notification sound when sending notification from firebase in android

I am sending push notification from firebase to my Android Application. but when my app is in background firebase onMessageReceived method is not called instead firebase send notification to system for showing notification in system…
103
votes
15 answers

Best way to serialize an NSData into a hexadeximal string

I am looking for a nice-cocoa way to serialize an NSData object into a hexadecimal string. The idea is to serialize the deviceToken used for notification before sending it to my server. I have the following implementation, but I am thinking there…
sarfata
  • 4,625
  • 4
  • 28
  • 36
98
votes
18 answers

Disable sound from NotificationChannel

Today I started targeting API 26 which forced me to use Notification Channels. My problem is that now on each new notification (including updates to it) an annoying sound is played. How can I disable this sound? I tried replacing this sound with a…
Daniel F
  • 13,684
  • 11
  • 87
  • 116
97
votes
14 answers

PendingIntent works correctly for the first notification but incorrectly for the rest

protected void displayNotification(String response) { Intent intent = new Intent(context, testActivity.class); PendingIntent pendingIntent = PendingIntent.getActivity(context, 0, intent, Intent.FLAG_ACTIVITY_NEW_TASK); Notification…
user350617
97
votes
5 answers

How to remove notification from notification bar programmatically in android?

How can one remove a notification from an application programmatically, which is called using Pending intent? I have used to cancel notification using following method: AlarmManager am=(AlarmManager)getSystemService(Context.ALARM_SERVICE); Intent…