本文介绍了如何显示活动当屏幕被锁定?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的应用程序在汽车对接活动推出,我要唤醒手机(由系统来完成)和解锁屏幕时,我插入我的设备。难道posssible?

My application is launched on car docking event, i want to wake up phone (done by system) and unlock screen when i plug my device.Is it posssible ?

推荐答案

我使用了正在增加活动,以顶级

I'm use for upping activity to top level

    private Window wind;
    @Override
protected void onResume() {
    // TODO Auto-generated method stub
    super.onResume();
    /******block is needed to raise the application if the lock is*********/
    wind = this.getWindow();
    wind.addFlags(LayoutParams.FLAG_DISMISS_KEYGUARD);
    wind.addFlags(LayoutParams.FLAG_SHOW_WHEN_LOCKED);
    wind.addFlags(LayoutParams.FLAG_TURN_SCREEN_ON);
    /* ^^^^^^^block is needed to raise the application if the lock is*/
}

这篇关于如何显示活动当屏幕被锁定?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

06-03 14:17