How to display Activity when the screen is locked?

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*/
}

Leave a Comment