Use FLAG_SECURE for Android.

Hi All,

I know expo does not support this at the moment.
I want to create a security screen when the user switch out of the app.
I can use AppState to pop up a modal screen when the user switch out of the app on IOS.
But it does not work on Android.

So I found a solution to add 4 lines of native Android code to the MainActivity file. like this

 getWindow().setFlags(
            WindowManager.LayoutParams.FLAG_SECURE,
            WindowManager.LayoutParams.FLAG_SECURE
        );

For reference please check out this blog post.

So I wonder is there anyway to accomplish this? Even means that I need to create a native module for Expo something like expo-secure-store. I don’t really know the process, if someone can point me to the right path, it’d be greatly appreciated.

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.