Sketchware Notification code

Code
Notification.Builder mBuilder = new Notification.Builder(MainActivity.this);
mBuilder.setSmallIcon(R.drawable.ic_android_black);
mBuilder.setContentTitle("click hare");
mBuilder.setContentText("subscribe");
mBuilder.setDefaults( Notification.DEFAULT_SOUND | Notification.DEFAULT_VIBRATE);
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);
notificationManager.notify(1, mBuilder.build());
Sketchware Notification code Sketchware  Notification code Reviewed by manek inc on October 28, 2017 Rating: 5

No comments:

Powered by Blogger.