[REFERENCE LINK] https://forum.processing.org/two/discussion/4429/notifications-in-android-mode https://forum.processing.org/two/discussion/16840/how-to-create-notifications-even-when-the-app-is-closed
How to create notifications, even when the app is closed.
Is it impossible with the Processing(android mode) program?
https://developer.android.com/guide/topics/ui/notifiers/notifications.html#CreateNotification
[EXAM]
import android.view.MotionEvent;
import android.content.Context;
import android.app.Notification;
import android.app.NotificationManager;
import android.app.Activity;
Activity act;
NotificationManager gNotificationManager;
Notification gNotification;
long[] gVibrate = {0,250,50,125,50,62};
Context ctx;
void setup() {
size(displayWidth, displayHeight);
}
void draw() {
}
void onResume() {
super.onResume();
// Create our Notification Manager:
gNotificationManager = (NotificationManager) this.getActivity().getSystemService(Context.NOTIFICATION_SERVICE);
// Create our Notification that will do the vibration:
gNotification = new Notification();
// Set the vibration:
gNotification.vibrate = gVibrate;
}
public boolean surfaceTouchEvent(MotionEvent event) {
// If user touches the screen, trigger vibration notification:
gNotificationManager.notify(1, gNotification);
return super.surfaceTouchEvent(event);
}
It does not work.