Launch the Always On Display app and lock the screen

I have an application that starts with it if it receives a message. To do this, I use this initial parameter:

BackgroundService.java:

Intent intent = new Intent(this, MainActivity.class);
    intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TASK)
            .addFlags(WindowManager.LayoutParams.FLAG_DISMISS_KEYGUARD)
            .addFlags(WindowManager.LayoutParams.FLAG_SHOW_WHEN_LOCKED)
            .addFlags(WindowManager.LayoutParams.FLAG_TURN_SCREEN_ON)
            .addFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON);
    startActivity(intent);

      

MainActivity.java -> onCreate:

getWindow().addFlags(WindowManager.LayoutParams.FLAG_SHOW_WHEN_LOCKED);
getWindow().addFlags(WindowManager.LayoutParams.FLAG_DISMISS_KEYGUARD);
getWindow().addFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON);
getWindow().addFlags(WindowManager.LayoutParams.FLAG_TURN_SCREEN_ON);

      

Now I got a message from the user of my application that this does not work with his "Samsung Galaxy S7" and he noticed that he was using the "Always on display" feature.

I've searched the internet for a while, but I haven't found a solution. Are there a few more tags?

+3


source to share





All Articles