I had a problem during the development of my mobile application in flutter. My app was always in the foreground (even when the phone was locked).

If this happens to you, I have the solution for you:

1- Open your AndroidManifest.xml file. 2- Find your app's activity tag. 3- Change the value of the android:showWhenLocked attribute to false to indicate that your app should not be displayed in the foreground when the phone screen is locked.

The code : android:showWhenLocked="false