Android FullScreenIntent不显示全屏,也不会唤醒设备

Android FullScreenIntent不显示全屏,也不会唤醒设备,android,Android,对于闹钟应用程序,我需要在特定时间唤醒设备,并播放一个带有屏幕的闹钟,该屏幕允许取消闹钟,类似于android上的默认闹钟应用程序。为此,我实现了一个AlarmManager,它向BroadcastReceiver发送意图。在这里,我想然后发射一个完整的屏幕意图。问题是,如果设备被锁定,它不会被唤醒。与android的闹钟应用程序不同,当我打开手机时,它只在顶部显示一个小通知,但不会启动全屏。我在BroadcastReceiver中使用的代码如下所示: public class AlarmBro

对于闹钟应用程序,我需要在特定时间唤醒设备,并播放一个带有屏幕的闹钟,该屏幕允许取消闹钟,类似于android上的默认闹钟应用程序。为此,我实现了一个AlarmManager,它向BroadcastReceiver发送意图。在这里,我想然后发射一个完整的屏幕意图。问题是,如果设备被锁定,它不会被唤醒。与android的闹钟应用程序不同,当我打开手机时,它只在顶部显示一个小通知,但不会启动全屏。我在BroadcastReceiver中使用的代码如下所示:

public class AlarmBroadcastReceiver extends BroadcastReceiver {
    private final String CHANNEL_ID = "myChannelID";

    @Override
    public void onReceive(Context context, Intent intent) {


        createNotificationChannel(context);
        NotificationManager notificationManager = (NotificationManager) context.getSystemService(context.NOTIFICATION_SERVICE);
        Intent fullScreenIntent = new Intent(context, RiningActivity.class);
        PendingIntent fullScreenPendingIntent = PendingIntent.getActivity(context, 0, fullScreenIntent, PendingIntent.FLAG_UPDATE_CURRENT);

        NotificationCompat.Builder notificationBuilder = new NotificationCompat.Builder(context, CHANNEL_ID)
                        .setSmallIcon(R.drawable.ic_cafferrring_notification)
                        .setContentTitle("Wake up!")
                        .setContentText("Up up!")
                        .setPriority(NotificationCompat.PRIORITY_MAX)
                        .setCategory(NotificationCompat.CATEGORY_ALARM)
                        .setFullScreenIntent(fullScreenPendingIntent, true);

        //Notification incomingCallNotification = notificationBuilder.build();

        notificationManager.notify(2, notificationBuilder.build());

        // Provide a unique integer for the "notificationId" of each notification.
        //startForeground(notificationId, notification);




    }

    private void createNotificationChannel(Context context) {
        // Create the NotificationChannel, but only on API 26+ because
        // the NotificationChannel class is new and not in the support library
        if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
            CharSequence name = CHANNEL_ID;//context.getString(R.string.channel_name);
            String description = CHANNEL_ID;//context.getString(R.string.channel_description);
            int importance = NotificationManager.IMPORTANCE_HIGH;
            NotificationChannel channel = new NotificationChannel(CHANNEL_ID, name, importance);
            channel.setDescription(description);
            // Register the channel with the system; you can't change the importance
            // or other notification behaviors after this
            NotificationManager notificationManager = context.getSystemService(NotificationManager.class);
            notificationManager.createNotificationChannel(channel);
        }
    }
}