Fatal Exception: android.app.RemoteServiceException: Bad notification posted Fatal Exception: android.app.RemoteServiceException: Bad notification posted from package com.noti: Couldn't update icon: StatusBarIcon(icon=Icon(typ=RESOURCE pkg=com.noti id=0x00000000) visible user=0 )
Notification.Builder mBuilder = new Notification.Builder(context);
if (android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.M) {
mBuilder.setSmallIcon(convertStringToBitmap(StringUtils.appendDegree("12")));
} else {
mBuilder.setSmallIcon(R.drawable.notification_icon);
}
// Creates an explicit intent for an Activity
Intent resultIntent = new Intent(context, HomeActivity.class);
resultIntent.putExtra(AppConstants.IS_ONGOING, true);
resultIntent.addFlags(Intent.FLAG_ACTIVITY_SINGLE_TOP);
PendingIntent resultPendingIntent = PendingIntent.getActivity(context, 0, resultIntent, 0);
mBuilder.setContentIntent(resultPendingIntent);
Notification notification =mBuilder.build();
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN) {
if (getComplexNotificationView(context) != null) {
notification.contentView = …
Run Code Online (Sandbox Code Playgroud)