Custom notification in Sketchware
In extra block:
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
CharSequence name = "Channel name 1";
String description = "Notification channel";
int importance = NotificationManager.IMPORTANCE_DEFAULT;
NotificationChannel channel = new NotificationChannel("id 1", name, importance);
channel.setDescription(description);
NotificationManager notificationManager = getSystemService(NotificationManager.class);
notificationManager.createNotificationChannel(channel);
}
In button:
RemoteViews contentView = new RemoteViews(getPackageName(), R.layout.cview);
Intent intent = new Intent(MainActivity.this, TwoActivity.class);
intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_CLEAR_TASK);
PendingIntent pendingIntent = PendingIntent.getActivity(MainActivity.this, 0, intent, 0);
android.support.v4.app.NotificationCompat.Builder builder = new android.support.v4.app.NotificationCompat.Builder(MainActivity.this, "id 1")
.setSmallIcon(R.drawable.mail_white)
.setSound(RingtoneManager.getDefaultUri(RingtoneManager.TYPE_NOTIFICATION))
.setContent(contentView)
.setPriority(android.support.v4.app.NotificationCompat.PRIORITY_DEFAULT)
.setContentIntent(pendingIntent)
.setAutoCancel(true);
android.support.v4.app.NotificationManagerCompat notificationManager = android.support.v4.app.NotificationManagerCompat.from(MainActivity.this);
notificationManager.notify(1, builder.build());

Bro how to contact you please help me I want a help bro and I have 7k subs channel I will promote you
ReplyDeleteI think your lying about promoting
DeleteNo I have a channel bro okay if you think I am a lier just don't answer this question okay
DeleteOnly fb
Deletehttps://www.facebook.com/swift.rein
Bro i have a question can you explain how custom view listener works
ReplyDelete