I'm developing an app that works with sensitive information.
One of the requirements is that when a user puts the app in background the content that the app is currently displaying has to be hidden, so if another person navigate through the apps in background he can't see the last screen where the user was.
Any ideas on how to do that?
I tried to show an overlay when the app moves to AppLifecycleState.paused
, but it doesn't work for me, the app prints a message if I want but it can't update the UI.
Edit Shameless plug: i did a library for doing just that as I also needed it:
https://pub.dev/packages/secure_application
Answear
Build is not called after paused, at least on Android.
For Android I used a flutter_windowmanager package (modified to still be able to build on IOS):
https://github.com/neckaros/flutter_windowmanager
When my app need securing I add the flag secure:
FlutterWindowManager.addFlags(FlutterWindowManager.FLAG_SECURE)
And my app is now a black screen in the app switcher. You should still hide content your way for when the user get back to the app.
Otherwise you can go native: https://medium.com/@mehmetf_71205/securing-flutter-apps-ada13e806a69
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With