1

Hello everybody I wrote a Android-App and it works fine but there is one problem that I want to solve. My problem is I don't want the app working like this (see picture 1) you know you can go to last apps (like picture 2 ) and open app in the little window. My question is how to stop my app when someone is doing it .(I'm very sorry about my English,I'm still learning . I hope you understand it guys ). Thank you in advance.

picture1 picture1 picture2 picture2

Jon Goodwin
  • 9,053
  • 5
  • 35
  • 54
MIkey014
  • 13
  • 4

2 Answers2

1

You can setandroid:noHistory in manifest of your activity to true as follows if you want to want to avoid user revisiting your app:

 <activity android:name=".YourActivity"
            android:noHistory="true"/>

Based on the documentation:

A value of "true" means that the activity will not leave a historical trace. It will not remain in the activity stack for the task, so the user will not be able to return to it.

Looking at your image, looks like you want to disable the multi-window support:

You need to set following flag:

android:resizeableActivity="false" in you application as follows:

<application 
   android:resizeableActivity="false" >
    . . .
</application>

This will disable the multi-window support for your entire app. If you just want a particular activity for which this should be disabled, then you can:

<activity android:name=".MainActivity"
    ...
    android:resizeableActivity="false" />
Sagar
  • 23,903
  • 4
  • 62
  • 62
0

Try adding getWindow().addFlags(WindowManager.LayoutParams.FLAG_SECURE); in your onCreate() method.

Source: https://stackoverflow.com/a/9822607/9723698

Bartu
  • 119
  • 8