Reputation: 299
I have a notification in my application that I show like this:
NotificationCompat.Builder mBuilder = new NotificationCompat.Builder(context);
// Check if we're running on Android 5.0 or higher
if (Build.VERSION.SDK_INT >= 21) {
mBuilder.setSmallIcon(R.drawable.ic_notification_icon_24dp);
} else {
mBuilder.setSmallIcon(R.mipmap.ic_launcher);
}
mBuilder.setContentTitle("Where's my colleague?");
mBuilder.setContentText(name + " is at the " + location);
mBuilder.setVibrate(new long[]{500, 500, 500, 500, 500});
mBuilder.setLights(Color.BLUE, 3000, 3000);
mBuilder.setVisibility(NotificationCompat.VISIBILITY_PUBLIC);
mBuilder.setPriority(NotificationCompat.PRIORITY_MAX);
mBuilder.setWhen(System.currentTimeMillis());
NotificationManager mNotificationManager = (NotificationManager) context.getSystemService(Context.NOTIFICATION_SERVICE);
mNotificationManager.notify(9999, mBuilder.build());
On Lollipop devices, the notification shows like I want: It appears on my lock screen and the notification floats over my current active application. On Kitkat devices the notification only shows in the notification area, but doesn't appear on my lock screen or doesn't float above my active application. Is it possible to achieve the same behaviour on Kitkat devices?
Notifications of my messaging app (on the Kitkat device) do have this behaviour, hence I should think it is possible...
FYI: it's not a problem with my security settings. Everything is enabled for my application.
Upvotes: 0
Views: 1288
Reputation: 2849
Lock screen notifications are only available since Android 5.0 (Lollipop). But you can use 3rd party applications to enable the feature in Kitkat.
Upvotes: 1