Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/amazon-s3/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Java 如何在自定义锁屏之后调用本机锁屏_Java_Android - Fatal编程技术网

Java 如何在自定义锁屏之后调用本机锁屏

Java 如何在自定义锁屏之后调用本机锁屏,java,android,Java,Android,它完美地将本机锁定屏幕更改为自定义,但我不能再次更改为本机锁定屏幕。我怎么做?我是否应该以某种方式禁用服务或广播接收器 我正在使用服务和广播接收器更改锁屏 服务中的代码 if(isMustBeLocked) { IntentFilter filter = new IntentFilter(Intent.ACTION_SCREEN_ON); filter.addAction(Intent.ACTION_SCREEN_OFF); mReceiver = new LockSc

它完美地将本机锁定屏幕更改为自定义,但我不能再次更改为本机锁定屏幕。我怎么做?我是否应该以某种方式禁用
服务
广播接收器

我正在使用服务和广播接收器更改锁屏

服务中的代码

if(isMustBeLocked) {
    IntentFilter filter = new IntentFilter(Intent.ACTION_SCREEN_ON);
    filter.addAction(Intent.ACTION_SCREEN_OFF);

    mReceiver = new LockScreenReceiver();
    registerReceiver(mReceiver, filter);
    super.onCreate();
}
广播接收机中的代码

public void onReceive(Context context, Intent intent) {
    if (intent.getAction().equals(Intent.ACTION_SCREEN_OFF)) {
        if(!LockScreenService.isMustBeLocked) {
            // need to do something here
        }
    } else if (intent.getAction().equals(Intent.ACTION_SCREEN_ON)) {
        Intent intent11 = new Intent(context,LockScreenActivity.class);
        intent11.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
    } else if(intent.getAction().equals(Intent.ACTION_BOOT_COMPLETED)) {
    }
}