Closed minhdanh closed 2 years ago
I understand that the package uses the resume lifecycle event to execute the code. This event is fired when we switch to another app and switch back, or open the task switcher. But what is the point of locking an app, when you can bypass that by closing and opening the app again? 🤔
I understand that the package uses the resume lifecycle event to execute the code. This event is fired when we switch to another app and switch back, or open the task switcher. But what is the point of locking an app, when you can bypass that by closing and opening the app again? 🤔
You are free to have a state locked by default on your app. You can for example call lock on the SecureApplicationController
Thank you for the hint. I can make app locked on first launch now:
final secureApplicationController = SecureApplicationController(
SecureApplicationState(
locked: true,
secured: true,
),
);
return MaterialApp(
home: SecureApplication(
secureApplicationController: secureApplicationController,
nativeRemoveDelay: 500,
...
One small question though, with the default state is locked, what else I should do for the callback onNeedUnlock
to be called on app launch/opening (so that the app can ask for fingerprint automatically)?
what else I should do for the callback onNeedUnlock to be called on app launch/opening (so that the app can ask for fingerprint automatically)?
I could do that by using WidgetsBinding.instance?.addPostFrameCallback
:
class _UnlockScreenState extends State<UnlockScreen> {
@override
void initState() {
super.initState();
WidgetsBinding.instance?.addPostFrameCallback((_) => localAuthenticate());
}
...
Nice find. I will see if I can not make a easier solution without adding too much complexity to the plug-in
Hi, is there a reason this package doesn’t lock an app after launch? I’ve tried it and it just works when I switch to another app and come back. Can we make it work even when after we launch an app?