Is there a way to display a specific Flutter page when screen is locked? - flutter

please is there a way to display or open a Flutter page when screen is locked in Flutter like how WhatsApp displays incoming call page when screen is locked? I used Wake up plugin but can't display the page on screen locked. Please I need a guide to do that. Thanks in advance.

What you are looking for is called a time sensitive notification with a full screen notification. What it does is that if the screen is locked it opens the activity linked to the pending intent used for full screen notification. When the phone is unlocked, it shows a heads up notification instead. You must have seen this behavior with all kinds of telephony apps and alarm apps.
A flutter app runs inside a single activity, so if you mark that as the activity to show during the locked state, the app will show. But it will act similar to how the app would when you launch it from start. Also the behavior is unpredictable as it is behind a wakelock. So a better option would be to move it to a separate activity and do the needful. Example of how to implement full screen notifications.
https://medium.com/android-news/full-screen-intent-notifications-android-85ea2f5b5dc1

Related

How to detect if Flutter webview is in foreground or background?

I have a requirement where I need to record the time user spends viewing a certain attachment. I am opening the item in an external webview provided by flutter_inappwebview package on pub.dev.
Now to detect the amount of time user is spending I run timers. I want these timers to stop when the app is not in foreground, so I used Flutter's lifecycle events to detect this. The problem is, as soon as the webview is opened, the lifecycle event paused is called. Now i don't know if the user is viewing the item or has pushed the app to background.
Any leads will be helpful thanks.
I tried using flutter's lifecycle events, but they fire as soon as webview is launched and does not fire any other events after the webview is opened until user comes back to the app.

is there any way or package in flutter let me display specific app screen in my device home

say my app is running in foreground and I press my device home button and my app go to the background and there is services running in my app that listening to specific event to occur in order to start new screen ... my question is how can I let that new screen to be displayed in my device home just like coming call screen although my app is running in background ....
I want the screen to lunch like taxi booking app for driver when new request is coming so how to do that by flutter
I'm pretty sure you can't do that in Flutter, anyway not in any cross-platform way as Apple does not allow that.
Your best bet would be to send a notification that the user presses and which in turn will open the app.
If that something you would consider ?

Can I hide Flutter app contents when the app is in Background?

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

how to make the notification appear on the locked screen of iphone

i am having application in which i am showing notifications .The notifications are displayed properly when my app is in background but the problem is notification does not appear when the iphone screen is locked.Please help me in solving this problem.
This is a user preference that can be activated in the Notifications section of the Settings app. There is no way to control this from within your app.

Play splash movie every time app launch (with multi-task support)

the app I'm working on supports iOS multi-task feature by default, and I want to stick with this.
Upon app launch, a splash movie clip is played (code is in AppDelegate), after user hits the home button, and re-launches the app, I want to the same splash movie be played before showing the last view where use was.
I know by switching off the multi-task support, I can achieve this, but in the meanwhile, I'm losing the multi-task support feature, and I need to write code to save/resume user states. So, is there any workaround for this? thanks!
You could try the app delegate's applicationDidBecomeActive: method but quite frankly I'd consider this to be user hostile behaviour. Who wants to see a movie every time they switch between apps? The point of multitasking on the iPhone is to quickly change between apps and this violates that.