Added flags so Activity is displayed above lock screen, fixes #1

This commit is contained in:
bitscuit 2021-04-04 08:01:19 +02:00
parent a196c64486
commit 68ea94e8b5
1 changed files with 9 additions and 0 deletions

View File

@ -26,6 +26,7 @@ import android.media.AudioTrack;
import android.media.MediaPlayer;
import android.media.MediaRecorder;
import android.os.Bundle;
import android.view.WindowManager;
import android.widget.CompoundButton;
import android.widget.Switch;
import android.widget.TextView;
@ -50,6 +51,14 @@ public class MainActivity extends AppCompatActivity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
// Set flags so Activity is displayed above lock screen
getWindow().addFlags(
WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON |
WindowManager.LayoutParams.FLAG_DISMISS_KEYGUARD |
WindowManager.LayoutParams.FLAG_SHOW_WHEN_LOCKED |
WindowManager.LayoutParams.FLAG_TURN_SCREEN_ON
);
setContentView(R.layout.activity_main);
// Init views