# \[Android\] 'Notification' does not work

**URL:** https://discourse.processing.org/t/android-notification-does-not-work/14512
**Category:** Processing for Android
**Created:** [October 8, 2019, 11:27am UTC](https://discourse.processing.org/t/android-notification-does-not-work/14512 "2019-10-08T11:27:06Z")
**Posts on this page:** 7
**Page:** 1

<div class="post-metadata">

### Author: ![GWAK](https://avatars.discourse-cdn.com/v4/letter/g/13edae/32.png) [@GWAK](https://discourse.processing.org/u/GWAK)
#### Post date: [October 8, 2019, 11:27am UTC](https://discourse.processing.org/t/android-notification-does-not-work/14512/1 "2019-10-08T11:27:06Z")

</div>

```auto
import android.os.Build;

import android.app.NotificationChannel;
import android.app.NotificationManager;

import android.support.v4.app.NotificationCompat;
import android.support.v4.app.NotificationManagerCompat;

import static android.content.Context.NOTIFICATION_SERVICE;

String CHANNEL_ID = "processing_test.notifications";

void setup() {
  fullScreen();
  initNotifications();
}

void draw() {
  background(150);
}

void mousePressed() {
  showNotification();
}

void initNotifications() {
  if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
    // Create the NotificationChannel, but only on API 26+ because
    // the NotificationChannel class is new and not in the support library
    String name = "Manager";
    String description = "This is problem.";
    int importance = NotificationManager.IMPORTANCE_HIGH;
    NotificationChannel channel = new NotificationChannel(CHANNEL_ID, name, importance);
    channel.setDescription(description);
    // Register the channel with the system
    NotificationManager notificationManager = (NotificationManager)
      getContext().getSystemService(NOTIFICATION_SERVICE);
    notificationManager.createNotificationChannel(channel);
  }
}

void showNotification() {
  // Create an explicit intent for an Activity in your app
  NotificationCompat.Builder mBuilder = new NotificationCompat.Builder(getContext())
  
    .setSmallIcon(R.drawable.icon)
    .setContentTitle("This is a messsage")
    .setContentText("Mouse pressed event detected!")
    .setVisibility(NotificationCompat.VISIBILITY_PUBLIC)
    .setPriority(NotificationCompat.PRIORITY_HIGH)
    .setAutoCancel(true);

  // Show the notification
    NotificationManagerCompat notificationManager = NotificationManagerCompat.from(getContext());
  // notificationId is a unique int for each notification that you must define
  int notificationId = 666;
  notificationManager.notify(notificationId, mBuilder.build());
}

```

summary :

1. There is no debug problem.
2. Works well on Android version 6.0 smartphone.  
(The Notification screen appears.)
3. Does not work on Android version 9 smartphones.  
(Notification screen does not appear.)  
Why?

Hardware Information:

1. Samsung Galaxy S10
2. Android Version 9
3. Check the application notification settings

![ttt](https://canada1.discourse-cdn.com/flex036/uploads/processingfoundation1/original/2X/3/343139baba0d388e796057ec75879378ed5d6a50.jpeg)

---

<div class="post-metadata">

### Author: ![akenaton](https://avatars.discourse-cdn.com/v4/letter/a/a88e4f/32.png) [@akenaton](https://discourse.processing.org/u/akenaton)
#### Post date: [October 8, 2019, 4:11pm UTC](https://discourse.processing.org/t/android-notification-does-not-work/14512/2 "2019-10-08T16:11:05Z")

</div>

@GWAK === have you created a Channel\_ID? - If you dont the notification cannot appear on phones using 8 and 8+ but they appear on 6 (MM).

---

<div class="post-metadata">

### Author: ![GWAK](https://avatars.discourse-cdn.com/v4/letter/g/13edae/32.png) [@GWAK](https://discourse.processing.org/u/GWAK)
#### Post date: [October 9, 2019, 11:32pm UTC](https://discourse.processing.org/t/android-notification-does-not-work/14512/3 "2019-10-09T23:32:06Z")

</div>

@akenaton

Thank you for the answer.

void **initNotifications ()** \>\> Is this not your channel ID(create)??  
This is done in setup function.

Am I wrong? Please review. help me.

---

<div class="post-metadata">

### Author: ![GWAK](https://avatars.discourse-cdn.com/v4/letter/g/13edae/32.png) [@GWAK](https://discourse.processing.org/u/GWAK)
#### Post date: [October 13, 2019, 4:13pm UTC](https://discourse.processing.org/t/android-notification-does-not-work/14512/4 "2019-10-13T16:13:33Z")

</div>

@akenaton

What’s the problem?

---

<div class="post-metadata">

### Author: ![GWAK](https://avatars.discourse-cdn.com/v4/letter/g/13edae/32.png) [@GWAK](https://discourse.processing.org/u/GWAK)
#### Post date: [October 17, 2019, 6:56am UTC](https://discourse.processing.org/t/android-notification-does-not-work/14512/5 "2019-10-17T06:56:17Z")

</div>

Please help me ~~  
Please help me ~~

---

<div class="post-metadata">

### Author: ![akenaton](https://avatars.discourse-cdn.com/v4/letter/a/a88e4f/32.png) [@akenaton](https://discourse.processing.org/u/akenaton)
#### Post date: [October 19, 2019, 2:38pm UTC](https://discourse.processing.org/t/android-notification-does-not-work/14512/6 "2019-10-19T14:38:13Z")

</div>

@Gwak === dear Gwak the problem is that i am very very busy now, that s all,and it is difficult to answer to all questions at the same time…As for the channel you are right, you have a string in your vars so this is not the reason why the notif does not appear with 8+

---

<div class="post-metadata">

### Author: ![GWAK](https://avatars.discourse-cdn.com/v4/letter/g/13edae/32.png) [@GWAK](https://discourse.processing.org/u/GWAK)
#### Post date: [October 23, 2019, 11:45am UTC](https://discourse.processing.org/t/android-notification-does-not-work/14512/7 "2019-10-23T11:45:10Z")

</div>

@akenaton

Thank you for your kind reply.
