IBM Worklight - hiding splash screen - ibm-mobilefirst

I want to hide the screen splah of my app and i'm trying to do this with Cordova function navigator.splashscreen.hide() according to this
function wlEnvInit(){
wlCommonInit();
document.addEventListener("deviceready", onDeviceReady, false);
function onDeviceReady() {
alert("device is ready!");
navigator.splashscreen.hide();
}
}
I placed this code on android/js/myAppName.js and iphone/js/myAppName.js folders. It does not work. There is something wrong?

I assume what you're trying to do is to hide the splash image at a point in time based on your own preference? This is currently not possible.
Worklight bypasses Cordova's splash image mechanism as well as does not provide an API to manipulate its duration programmatically (= choose when to hide it). This is an area that is destined to change in a future release.
If what you're trying to do is to simply not show a splash image at all, then:
In iOS: this is not possible. The splash image is mandatory by Apple
In Android: simply delete the splash.9.png image file from the yourProject\apps\yourApp\android\native\res\drawable folder
BTW, I do not see the use for the deviceready listener, because if you've reached wlCommonInit, then the device (Cordova...) has already been initialized. The app would not have functioned otherwise.

For the time being, a workaround for it would be by replacing the Splash screen image with a complete white background screen/image.

Related

How can I rotate entire android screen in react-native?

I am new in react-native, and I wanna to rotate entire screen manually in react-native, is it possible?
Inside application, on click button start screen goes in background with floating buttons and it start recording screen, I wanna to rotate screen manually from floating button which was in background. rotate screen over all application.
I have checked react-native-orientation and react-native-orientation-locker npm modules which works only on particular application screen rotation.
Is it possible in react-native or not?
Yes, it is possible to rotate your view based on your requirements. but for this, I think you have to manage it yourself.
You can achieve to by using the transform API.
refer to the official documentation for how to transform the layout.
https://reactnative.dev/docs/transforms

How to play an intro animation on splash screen with react native expo?

Currently, if I add a .gif to app.json, it does not work
"splash": {
"image": "./assets/splash.gif"
}
Edit: It looks like, they are currently working on it, here: (https://expo.canny.io/feature-requests/p/improved-splash-screen-api).
I see you are trying to use gif for the splash screen. Well I have a bad news. Splash screen API of native platform (iOS & Android) doesn't support gif, infact they only support 'png' images.
But, the good news is there is a work around.
We had a similar requirement in our project so we created our custom AppLoading (Provided by Expo) component which has a face of our gif image and in the background it works similar to AppLoading i.e. fetch data and caching. We used a static png image for default splash screen and the transition between static image to gif worked for us.
This is the simplest way but has a drawback that between the static splash screen and animated there is white screen visible for a short duration of time.
It happens due to the fact that your javascript bundle is being downloaded in the background and until and unless your entire JS doesn't load you will see a white screen.
To overcome this you need to detach your expo app as we will be doing some native changes.
Install and follow the instruction in this module.
Benefit of this module is that it exposes the 'hide' function in the javascript.
Basic flow of App.
App loading start => Static splash screen visible
Screen is visible till our javascript bundle is not loaded
Bundle loads => call hide function exposed by modules on ComponentDidMount of SplashScreen component
Static Splash screen hides => Animated splash screen is visible with background task working (caching and API call)
Further App Flow
If you're talking about the launch screen and you're not using create-react-native-app you'll have to edit the native launch screen per platform to use your animation.
If you're using create-react-native-app with Expo then you could look at the Splash Screen API.
Expo since version 29 supports animated SVG and GIF. It also provides an API to generate your own splash screens without AppLoading.
Please check: https://docs.expo.io/versions/v29.0.0/sdk/splash-screen#example-without-apploading
Expo team has completed: "Improved Splash Screen API" ticket. So now, you can do it as explained in their docs: https://docs.expo.io/versions/v29.0.0/sdk/splash-screen/!

Disable launch transition in WP 8.1 app

I wonder if it's possible delete the transition that leads to my WP8.1 universal app when it's launched. So, when my app is launched, I want it to just show the SplashScreen without any animation. I've already read this and this questions, but since I'm not navigating between pages within my app, I can't just set "ContentTransitions" of my frame to null.
Does anybody have any information on this? Or is it just not possible, since these "launching" transitions are managed by the OS?
Disable the animations on the Frame, hook up the Frame`s navigated event and enable them back after first navigation. I have a post about this here.
The initial splash screen is displayed by the OS until you call Window.Current.Activate(). You cannot disable/modify this transition, and you should also not try to do so as your app will lose parity with the rest of OS ecosystem.

Recovering Stage3D context after viewing iAd using Starling and Air for iOS

I have an app using Starling and a native extension for iAds (Milkman Games iAds Extension)
I noticed that when a user clicks the iad, interacts with it and then returns to the game there is a long delay with a black screen as Starling recovers a Stage3D context.
I would like to be able to show some sort of loading screen during this time, but everything I try doesn't seem to work.
Does anyone have a suggestion how to implement this? Is it even possible?
This is just a theory, haven't tested it but it should work.
Listen for Event.ACTIVATE. This should trigger when the iAd is closed. It's also triggered a lot of other times so we need to make sure that we check for this black screen, to do this we can simply have this inside the event handler:
private function _onActivateHandler(e:Event):void
{
if (starling.context.driverInfo.indexOf("Disposed") != -1)
{
this.addChild(loadingTextOrBitmapEtcEtc);
starling.stage3D.addEventListener(Event.CONTEXT3D_CREATE, this._onContext3DCreateHandler);
}
}
private function _onContext3DCreateHandler(e:Event):void
{
starling.stage3D.removeEventListener(Event.CONTEXT3D_CREATE, this._onContext3DCreateHandler);
this.removeChild(loadingTextOrBitmapEtcEtc);
}

How to create animated splash screen not with Images in iOS

I want to know that how one should proceed in building animated splash screen.
I already did the animated splash screen with images but here I want to add custom animation like something is drawn on screen etc.
can anyone guide me through this.
simply you need to present a UIViewController which is hold your animations and dismiss it when your app is ready to launch. but also I think its better to follow apple HIG .. as apple describe you should
Supply a launch image to improve user experience.
Avoid using your launch image as an opportunity to provide:
An “application entry experience,” such as a splash screen An About
window Branding elements, unless they are a static part of your
application’s first screen Because users are likely to switch among
applications frequently, you should make every effort to cut launch
time to a minimum, and you should design a launch image that downplays
the experience rather than drawing attention to it.
Generally, design a launch image that is identical to the first screen
of the application.
Exceptions:
Text. The launch image is static, so any text you display in it will
not be localized.
UI elements that might change. Avoid including elements that might
look different when the application finishes launching, so that users
don’t experience a flash between the launch image and the first
application screen.