Flutter Native SplashScreens Background processes - flutter

I have created SplashScreens for my Flutter app for both iOS and Android using the native way which is editing the LaunchScreen.storyboard and it is working currently when I run my app but the SplashScreen does not hold long enough and is there a way to programmatically hide the native splashscreen in dart after I am done with some data processing and logic?
The solutions I found online are all flutter apps with SplashScreen that is build using flutter widgets and not the native way...

Even if you build the splash screen if Flutter, you still need to set one in via XCode. Otherwise, the app loads with a momentary plan white screen and Apple rejects it.
If you want to extend the time till the moment data process is over, then you will have to make a replica of LaunchScreen.storyboard in Flutter. The data processing and logic are written in Flutter. There's no way it can tell LaunchScreen.storyboard "I am done". What you can do is though, make a splash screen in Flutter which will look like LaunchScreen.storyboard. And once the data processing is done, you can navigate the user to the desired screen. Since the two screens are same, use won't see the difference and the app will smoothly show the next screen.
Just a word of caution - be careful about extending the timing of launch screen. Apple may reject the app. See if something can be done after the screen load. You can use flutter after layout package for this or the below line will do the trick :
WidgetsBinding.instance
.addPostFrameCallback((_) => myFunction(context));
This thread may help you to delay the screen for XX seconds.

Related

Animated splash screen for Android & iOS

To make an animation which can be used as splash screen for Android & iOS, I was thinking about using lotties (explained in this tutorial), but with Android 12 it seems like the tools used are deprecated and it's not really a good solution anymore.
I found this workaround to still make it work, but from what I understand, the splash screen is now waiting for the animation to finish, which I know is a bad practice and I don't really want to do that (maybe there is a way to interrupt it?).
I have seen some packages on pub.dev, but the animated ones seem to not really replace the launch screen (the white screen by default) and just start after it.
So my question is : is there any other way to create one animation which can be used both on Android & iOS? (which would be a looping animation, interrupted when the app is ready).

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 can I fix the delay of flutter app during launch?

When I run flutter app it delays for few seconds shows just white screen and then the main page is shown. How can i fix it
There is an entry in the docs about the launch screen.
https://flutter.io/docs/development/ui/assets-and-images#updating-the-launch-screen
Basically you can provide an image to be shown while flutter loads. The framework is not ready at that point though, so this is done on the platform side.

How to set SplashScreen after create build

I create a blank project in ionic. I also set splash screen in android platform. I can change the timing for this screen. All goes good.
But what if I want to set splash screen from by database at the time of installing this app. Is it possible or is there any other way.
#gautam It's not possible in Ionic or even any other mobile app developement platform
But you can do like reduce the time of splash screen to zero(0) and in device ready function you can call image from your database.

How to relaunch an Air-based iOS application from the very first page?

My application is an Air-based iPhone app. It opens with the last page I visited before clicking the Home button, each time I relaunch the app, while I need to open with the splash screen onward. How can I resolve this issue?
Thank you for any help.
When you press the Home button, you don't terminate a running app. I'm sure that many of us developers have stuck with this mental model of how iOS used to work without multitasking.
So, the splash screen, or rather, the default image (Default.png) should really appear once (when your application launches). Some times, the default image appears when coming out from the background state, but this happens only if your app takes too long to show its UI. In fact, on fast iPhones, the default image disappears almost instantly even on launch (for well-written apps, that is).
I should also note that Apple actively discourages the use of the default image for splash screens. These should only be used for creating an illusion of transition, from a "launching state" (which the default image is supposed to portray), to the running state.
However, if you really have to show a splash screen every time, you should implement such a mechanism in code. applicationDidBecomeActive: is a good place to start, if you are writing code in Objective-C.
I don't know the event model in Air, so I can't really give you any hints for that.
The above answer, though old, does not answer the question. Sure, Apple gives guidelines regarding splash screen and all, but the poster asks how to prevent the app from resuming from it's previous position. If you want the app to terminate when put in the background you need to look into the UIApplicationExitsOnSuspend option. There's also an Adobe blog post explaining a bit more about different background behaviors.