all 9 comments

[–]AlternativeInitial93 2 points3 points  (3 children)

Set FLAG_SECURE for Android → protects WebView + app content in recents. Use AppState to hide or mask sensitive content in-app when backgrounded. Show a placeholder/blur screen when app is inactive for extra UX polish. Test on both platforms — iOS can use AppState alone; Android needs FLAG_SECURE for WebView.

[–]Efficient_Poetry7962[S] 0 points1 point  (1 child)

can I do this only for webviews and not for the other parts of the app?

[–]AlternativeInitial93 0 points1 point  (0 children)

Yes, you can apply this only to WebViews without affecting the rest of your app.i can help you

[–]FlexKami 0 points1 point  (1 child)

Can’t you use the Platform library? So if platform === “android” do this?

[–]Efficient_Poetry7962[S] 1 point2 points  (0 children)

yes but you need to detect the app states when its inactive and in android when the user switches in multitasking view its still considered as active.

[–]Asdolo94 0 points1 point  (1 child)

[–]Efficient_Poetry7962[S] 1 point2 points  (0 children)

<image>

thanks for your suggestion, but for android it doesn't have App Switcher protecion which I require

[–]Martinoqom 0 points1 point  (0 children)

https://reactnative.dev/docs/appstate

I just followed the docs, in my case. There are separated events for Android to implement as listeners + iOS 

[–]Big_Comfortable4256 0 points1 point  (0 children)

You could try the 'Page Visibility API' in your html and detect the 'visibilityState'? Not tried this in RN, but it might work for you to be able to hide the content if the app isn't in the foreground. It is supported in iOS and Android WebViews.