Create Notification in sketchware



Notification code


On resume

Notification.Builder mBuilder = new Notification.Builder(MainActivity.this);
mBuilder.setSmallIcon(R.drawable.baby_mobile_logo);
mBuilder.setContentTitle("Baby Mobile");
mBuilder.setContentText("play and create awesome experience");
NotificationManager notificationManager = (NotificationManager) getSystemService(Context.NOTIFICATION_SERVICE);
Intent notificationIntent = new Intent(
getApplicationContext(), MainActivity.class);
PendingIntent pendingIntent = PendingIntent.getActivity(
getApplicationContext(),
0,
notificationIntent,
Intent.FLAG_ACTIVITY_NEW_TASK);
mBuilder.setContentIntent(pendingIntent).setAutoCancel(true);
mBuilder.setOngoing(true);
int onx = 2;
notificationManager.notify(onx, mBuilder.build());



Video Help



Post a Comment

Previous Post Next Post