My code for a notification works on Android API 25, but when I tried it on Android 10 it didn't work. I received no errors, it just simply did nothing at all. I have been trying to figure it out for the last two months without success. I failed to find anything helpful online and have tried everything I could possibly think of, but nothing has worked. Please help and thanks in advance.
Intent notificationIntent = new Intent(context, bibleReader.class); Bundle bundle = new Bundle(); notificationIntent.putExtras(bundle); notificationIntent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP | Intent.FLAG_ACTIVITY_MULTIPLE_TASK); PendingIntent contentIntent = PendingIntent.getActivity(context, 0, notificationIntent, PendingIntent.FLAG_UPDATE_CURRENT); NotificationManager mNotificationManager = (NotificationManager) context.getSystemService(Context.NOTIFICATION_SERVICE); Notification.BigTextStyle bigText = new Notification.BigTextStyle(); bigText.bigText(by); bigText.setSummaryText(bv); Notification.Builder NotificationBuilder; // check Android API verson and do as needed if (android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.O) { NotificationBuilder = new Notification.Builder(context, "ID_BN"); } else { NotificationBuilder = new Notification.Builder(context); } Notification.Builder mBuilder = NotificationBuilder; mBuilder.setSmallIcon(R.drawable.nicon); mBuilder.setContentTitle("A Word"); mBuilder.setContentText(bv); mBuilder.setStyle(bigText); mBuilder.setAutoCancel(true); mBuilder.setTicker("text"); mBuilder.setContentIntent(contentIntent); (android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.O) { mBuilder.setChannelId(CHANNEL_ID); } mNotificationManager.notify(1, mBuilder.build());