0

I have successfully used this solution to prevent my app content from being displayed on the multitasking view. I have adapted it for Xamarin.

This is my current solution :

public class MyActivity : FragmentActivity
{

    [...]

    protected override void OnCreate(Bundle bundle)
    {
        base.OnCreate(bundle);

        OverridePendingTransition(Resource.Animation.anim_in, Resource.Animation.anim_out);
        Window.SetFlags(WindowManagerFlags.Secure, WindowManagerFlags.Secure);
    }

    [...]

}

This works well on recent devices.

My question is : How do I get a similar behaviour on devices prior to Android API 17?

The Android doc mentions this flag was added in API 17, but doesn't mention any workaround for older versions. I need to support down to Android 4.0.3 (API 15) ideally.

Gabriel Bourgault
  • 842
  • 11
  • 22

1 Answers1

1

You're actually using FLAG_SECURE from WindowManagerFlags that were introduced in API level 1. Display flag FLAG_SECURE introduced in API level 17 is a different thing and I don't see you using it in your code. In conclusion, you should be just fine on API level 15 with the current implementation.

Timo Salomäki
  • 7,099
  • 3
  • 25
  • 40