I am thinking if statement for isJellyBeanOrHigher() but don't know how to implement it. Any suggestions on how to solve my issue would be very helpful. Below 4.1 it crashes the program.
Notification notification = new Notification.Builder(this)
.setContentTitle(
mContext.getString(R.string.ui_maps_display_notification_title))
.setContentText(
getResources().getString(
R.string.ui_maps_display_notification_content))
.setSmallIcon(R.drawable.ic_launcher).setContentIntent(pi)
.build();
mNotificationManager = (NotificationManager) getSystemService(NOTIFICATION_SERVICE);
notification.flags = notification.flags
| Notification.FLAG_ONGOING_EVENT;
mNotificationManager.notify(0, notification);
edit:
Notification notification = new NotificationCompat.Builder(this)
.setContentTitle(
mContext.getString(R.string.ui_maps_display_notification_title))
.setContentText(
getResources().getString(
R.string.ui_maps_display_notification_content))
.setSmallIcon(R.drawable.ic_launcher).setContentIntent(pi)
.build();
mNotificationManager = (NotificationManager) getSystemService(NOTIFICATION_SERVICE);
notification.flags = notification.flags
| Notification.FLAG_ONGOING_EVENT;
mNotificationManager.notify(0, notification);