如何在锁定屏幕上显示android推送通知?

Rag*_*aut 5 notifications android push-notification

我面临在锁定屏幕上显示推送通知的问题。我能够收到通知,但无法在锁定屏幕上显示它们。

Notification notification;
notification = mBuilder.setSmallIcon(icon).setTicker(title).setWhen(0)
            .setAutoCancel(true)
            .setContentTitle(title)
            .setContentIntent(resultPendingIntent)
            .setSound(alarmSound)
            //.setStyle(new NotificationCompat.BigTextStyle().bigText(message))
            .setStyle(new NotificationCompat.BigTextStyle().bigText(message))
            .setWhen(getTimeMilliSec(timeStamp))
            .setSmallIcon(R.drawable.loader)
            .setLargeIcon(BitmapFactory.decodeResource(mContext.getResources(), icon))
            .setContentText(message)
            .setVisibility(NotificationCompat.VISIBILITY_PUBLIC) //to show content on lock screen
            .setPriority(NotificationCompat.PRIORITY_HIGH)
            .build();

NotificationManager notificationManager = (NotificationManager) mContext.getSystemService(Context.NOTIFICATION_SERVICE);
notificationManager.notify(count, notification);
Run Code Online (Sandbox Code Playgroud)

我也试过使用 PowerManager,但它只唤醒锁定屏幕,但没有在屏幕上显示通知。

PowerManager powerManager = (PowerManager) mContext.getSystemService(POWER_SERVICE);

if (!powerManager.isInteractive()){ // if screen is not already on, turn it on (get wake_lock for 10 seconds)
    PowerManager.WakeLock wl = powerManager.newWakeLock(PowerManager.FULL_WAKE_LOCK |PowerManager.ACQUIRE_CAUSES_WAKEUP |PowerManager.ON_AFTER_RELEASE,"MH24_SCREENLOCK");
    wl.acquire(10000);
    PowerManager.WakeLock wl_cpu = powerManager.newWakeLock(PowerManager.PARTIAL_WAKE_LOCK,"MH24_SCREENLOCK");
    wl_cpu.acquire(10000);
}
Run Code Online (Sandbox Code Playgroud)

由于我是 android 新手,我无法解决这个问题。请帮帮我。