我的应用程序在汽车停靠事件中启动,我想在插入设备时唤醒手机(由系统完成)并解锁屏幕。
有可能吗?
最佳答案
我用于将 Activity 提升到顶层
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*/
}
关于android - 屏幕锁定时如何显示Activity?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/3793221/