Hi! Can I find a solution to get a notification?
Thanks.
NotificationManager notificationManager =
(NotificationManager) getSystemService(Context.NOTIFICATION_SERVICE);
int notifyId = 1;
int importance=notificationManager.IMPORTANCE_HIGH;
String channelId = “some-channel-id”;
String channelName= “text”;
Intent intent = new Intent( );
PendingIntent contentIntent = PendingIntent.getActivity(this, 0, intent, PendingIntent.FLAG_UPDATE_CURRENT);
notificationManager.areNotificationsEnabled();
Notification notification = new Notification.Builder(MainActivity.this,channelId)
.setContentTitle("Some Message")
.setContentText(textview.gettext ().toString())
.setContentIntent(contentIntent)
.setSmallIcon(R.drawable.ic_launcher)
.setChannelId(channelId).build();
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O);{
NotificationChannel notificationChannel= new NotificationChannel(channelId, channelName, importance);
notificationChannel = notificationManager.getNotificationChannel("some-channel-id");
notificationManager.createNotificationChannel(notificationChannel);
notificationChannel.setVibrationPattern(new long[]{0, 1000, 500, 1000});
notificationChannel.enableVibration(true);}
notificationManager.notify(notifyId, notification);
}
}}}