# Android - Push Notification

**URL:** <https://discourse.processing.org/t/android-push-notification/30658>\
**Category:** Processing for Android\
**Created:** [June 12, 2021, 8:17am UTC](https://discourse.processing.org/t/android-push-notification/30658 "2021-06-12T08:17:55Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Flolo](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/flolo/32/13874_2.png) [@Flolo](https://discourse.processing.org/u/Flolo)\
**Post date:** [June 12, 2021, 8:17am UTC](https://discourse.processing.org/t/android-push-notification/30658/1 "2021-06-12T08:17:55Z")

</div>

Hey, I wanted to ask if there is a way to send push notifications via Android processing.  
It does not matter whether it is Android Processing on the PC or APDE on the mobile phone.

If found this Topic: [Link](https://discourse.processing.org/t/android-notification-does-not-work/14512)  
With this code:

> **Click here to see the Code**
>
> ```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());
> }
> 
> ```

But it did not work pleas help

Thanks in advance  
Flolo

---

<div class="post-metadata">

**Author:** ![paulgoux](https://avatars.discourse-cdn.com/v4/letter/p/b9bd4f/32.png) [@paulgoux](https://discourse.processing.org/u/paulgoux)\
**Post date:** [June 12, 2021, 9:23am UTC](https://discourse.processing.org/t/android-push-notification/30658/2 "2021-06-12T09:23:14Z")

</div>

You can send toast notifications if i remember correctly. Check ketai and emmanuel pil girhub use google, they have some usable examples

---

<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:** [June 13, 2021, 3:27am UTC](https://discourse.processing.org/t/android-push-notification/30658/3 "2021-06-13T03:27:56Z")

</div>

@Flolo

Dear EmmanuelPil,  
This is the data compiled by ‘EmmanuelPil’.  
He arranged it for us.

> **[EmmanuelPil/Android-java-code-utilities-widgets-for-Processing-for-Android](https://github.com/EmmanuelPil/Android-java-code-utilities-widgets-for-Processing-for-Android)**
>
> Android code for Processing for Android. Contribute to EmmanuelPil/Android-java-code-utilities-widgets-for-Processing-for-Android development by creating an account on GitHub.

The source code you want is resolved if the processing version is higher.

i solved it like that
