# \[Android\] I can't find a solution. 'Notification pop up' is required

**URL:** <https://discourse.processing.org/t/android-i-cant-find-a-solution-notification-pop-up-is-required/14961>\
**Category:** Processing for Android\
**Created:** [October 27, 2019, 7:34am UTC](https://discourse.processing.org/t/android-i-cant-find-a-solution-notification-pop-up-is-required/14961 "2019-10-27T07:34:56Z")\
**Posts on this page:** 14\
**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 27, 2019, 7:34am UTC](https://discourse.processing.org/t/android-i-cant-find-a-solution-notification-pop-up-is-required/14961/1 "2019-10-27T07:34:56Z")

</div>

[Android] I can’t find a solution. ‘Notification pop up’ is required.

Reference: [[Android] 'Notification' does not work](https://discourse.processing.org/t/android-notification-does-not-work/14512)

 ![tt](https://canada1.discourse-cdn.com/flex036/uploads/processingfoundation1/original/2X/9/95d5ad3320590fbebd8e2e65e04a178e2c1ecaea.jpeg)

‘Notification pop up’ doesn’t work after Android version is higher.  
Can anyone solve it? Please help me. I want to solve

> 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());  
> }

---

<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 29, 2019, 7:39am UTC](https://discourse.processing.org/t/android-i-cant-find-a-solution-notification-pop-up-is-required/14961/2 "2019-10-29T07:39:41Z")

</div>

> **[Android Notifications Not Showing Up? 10 Fixes to Try](https://www.makeuseof.com/tag/android-notification-fixes/)**
>
> Not seeing Android notifications show up on your phone? Try these fixes to get Android notifications working again.

1. I set up in my smartphone like the above site But  
‘showNotification ();’ Does not work.

2. What is 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 29, 2019, 7:59am UTC](https://discourse.processing.org/t/android-i-cant-find-a-solution-notification-pop-up-is-required/14961/3 "2019-10-29T07:59:48Z")

</div>

> import android.os.Build;
> 
> import android.app.Notification;  
> 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 = “notification\_exam”;
> 
> void setup() {  
> fullScreen();  
> initNotifications();  
> }
> 
> void draw() {  
> background(150);  
> }
> 
> void mousePressed() {  
> println(“PRESS ACTION!”);  
> 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;
> 
> // int importance = NotificationManager.IMPORTANCE\_DEFAULT;  
> NotificationChannel channel = new NotificationChannel(CHANNEL\_ID, name, importance);  
> channel.setDescription(description);  
> channel.enableVibration(true); // 진동 주기
> 
> ```
> NotificationManager notificationManager = (NotificationManager)
> getContext().getSystemService(NotificationManager.class);
> notificationManager.createNotificationChannel(channel);
> 
> println("CASE-A");
> 
> ```
> 
> }else{  
> println(“CASE-B”);
> 
> }
> 
> }
> 
> void showNotification() {
> 
> NotificationCompat.Builder mBuilder = new NotificationCompat.Builder(getContext())  
> .setSmallIcon(R.drawable.icon)  
> .setContentTitle(“This is a messsage”)  
> .setContentText(“Mouse pressed event detected!”)  
> // .setTicker(“Notification!”)  
> // .setColor(color(#FFE74C3C))  
> .setWhen(System.currentTimeMillis())  
> //.setVibrate(new long { 1000, 1000, 1000, 1000, 1000 })  
> .setVisibility(NotificationCompat.VISIBILITY\_PUBLIC)  
> .setPriority(NotificationCompat.PRIORITY\_MAX) // PRIORITY\_HIGH  
> .setOngoing(true)  
> .setAutoCancel(true);
> 
> ```
> mBuilder.setVibrate(new long[] { 1000, 1000});
> 
> ```
> 
> // mBuilder.setSound(Settings.System.DEFAULT\_NOTIFICATION\_URI);
> 
> //NotificationManager mNotifyMgr = (NotificationManager) this.getContext().getSystemService(NOTIFICATION\_SERVICE);  
> [//mNotifyMgr.notify](https://mNotifyMgr.notify)(001, mBuilder.build());
> 
> NotificationManagerCompat notificationManager = NotificationManagerCompat.from(getContext());  
> int notificationId = 666;  
> notificationManager.notify(1, mBuilder.build());
> 
> }

Solve!!! Thanks. ^^

---

<div class="post-metadata">

**Author:** ![noel](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/noel/32/213_2.png) [@noel](https://discourse.processing.org/u/noel)\
**Post date:** [October 29, 2019, 8:54am UTC](https://discourse.processing.org/t/android-i-cant-find-a-solution-notification-pop-up-is-required/14961/4 "2019-10-29T08:54:13Z")

</div>

Great! Did you also manage to get my popup menu code working?

---

<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 29, 2019, 9:47am UTC](https://discourse.processing.org/t/android-i-cant-find-a-solution-notification-pop-up-is-required/14961/5 "2019-10-29T09:47:57Z")

</div>

@GWAK ===  
what have you changed in the code for solving?

---

<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 29, 2019, 11:53am UTC](https://discourse.processing.org/t/android-i-cant-find-a-solution-notification-pop-up-is-required/14961/6 "2019-10-29T11:53:02Z")

</div>

@akenaton

mBuilder.setChannelId(CHANNEL\_ID); \<\< this

---

<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 29, 2019, 11:54am UTC](https://discourse.processing.org/t/android-i-cant-find-a-solution-notification-pop-up-is-required/14961/7 "2019-10-29T11:54:07Z")

</div>

@noel  
I’m trying now.  
thank you.

---

<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 29, 2019, 5:58pm UTC](https://discourse.processing.org/t/android-i-cant-find-a-solution-notification-pop-up-is-required/14961/8 "2019-10-29T17:58:50Z")

</div>

@GWAK ==== i dont understand:  
the previous code you posted was:

```auto
NotificationChannel channel = new NotificationChannel(CHANNEL_ID, name, importance);

```

and it is the same… The unique explanation i can see is the first CHANNEL\_ID uses a string with forbidden chars but in this case why it does not fire an error?

---

<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 29, 2019, 8:29pm UTC](https://discourse.processing.org/t/android-i-cant-find-a-solution-notification-pop-up-is-required/14961/9 "2019-10-29T20:29:57Z")

</div>

@akenaton

I will tell you about my test.

1. Processing Does not work on Android 3.0.
2. Processing Works with Android 4.0.
3. 

NotificationCompat.Builder mBuilder = new NotificationCompat.Builder (getContext ())

mBuilder.setChannelId (CHANNEL\_ID);

The channel ID input was sent to mBuilder. I do not know why, but it worked.

---

<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 30, 2019, 8:23am UTC](https://discourse.processing.org/t/android-i-cant-find-a-solution-notification-pop-up-is-required/14961/10 "2019-10-30T08:23:36Z")

</div>

@GWAK ===  
sorry, i dont understand; what is this android 4 vs 3??? - You never spoke about that in your previous posts; in this type of case it is very difficult to help!

---

<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 30, 2019, 11:58am UTC](https://discourse.processing.org/t/android-i-cant-find-a-solution-notification-pop-up-is-required/14961/11 "2019-10-30T11:58:50Z")

</div>

@akenaton

Dear akenaton,  
Good morning.

I’m talking about Android mode version.

In Android mode 3.0  
'mBuilder.setChannelId (CHANNEL\_ID); 'Error.

However, in Android mode 4.0  
'mBuilder.setChannelId (CHANNEL\_ID); ’  
It works.

This solved ‘Notification’.

 ![t2](https://canada1.discourse-cdn.com/flex036/uploads/processingfoundation1/original/2X/d/d246095483309f814f08e2ce26d2bf8ccde0e6d2.jpeg) ![tt](https://canada1.discourse-cdn.com/flex036/uploads/processingfoundation1/original/2X/7/73a43ff9ceb06e6a4d8e11ca19a42342bade1602.jpeg)

But there was a problem.  
Text is broken after Android Mode 4.0  
help me.

> [@Is there an Android Mode 4.1 problem(characters are broken.) / solution?](https://discourse.processing.org/t/is-there-an-android-mode-4-1-problem-solution/15033):
>
> ‘Foreign language is not expressed.’ Even if you change the font, the characters are broken. ex) Korean, Japanese, Chinese, etc. [problem] println() does not work. Is there a solution? Help. I need your help.

---

<div class="post-metadata">

**Author:** ![noel](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/noel/32/213_2.png) [@noel](https://discourse.processing.org/u/noel)\
**Post date:** [October 30, 2019, 12:50pm UTC](https://discourse.processing.org/t/android-i-cant-find-a-solution-notification-pop-up-is-required/14961/12 "2019-10-30T12:50:47Z")

</div>

@akenaton I think he means [this](https://android.processing.org/install.html) previous mode.

---

<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 30, 2019, 2:30pm UTC](https://discourse.processing.org/t/android-i-cant-find-a-solution-notification-pop-up-is-required/14961/13 "2019-10-30T14:30:00Z")

</div>

@noel ===  
yes i think also, but the 2 codes are quite (the string declared for CHANNEL\_ID is the unique change) the same and as he never speaks about 4.0/3.0 before how can you guess and help  
BTW : i see that you have put in github something about “onPause()” bug; as i never got any problem with onPause() can you put some code snippet to verify?

---

<div class="post-metadata">

**Author:** ![noel](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/noel/32/213_2.png) [@noel](https://discourse.processing.org/u/noel)\
**Post date:** [October 30, 2019, 4:27pm UTC](https://discourse.processing.org/t/android-i-cant-find-a-solution-notification-pop-up-is-required/14961/14 "2019-10-30T16:27:20Z")

</div>

The code that verifie’s it is on the same issue in github.
