I have an Ionic hybrid mobile app. After a recent build, I noticed that my app goes fullscreen (statusbar visible) after start for no reason. The first view is a Google Map and when it is loaded, the ionic.Platform.fullScreen(false, true); is called. It is because if the user opens the app for first time, there's a fullscreen intro shown, then the user is navigated to the map, which shouldn't be fullscreen. If this transition happens (the intro is opened) everything is fine, but if the user opens the app second+ time (no intro), then the map gets fullscreen with the statusbar visible, so half of the header is covered.
This happens only on Android. I recently upgraded Cordova CLI version, cordova-andoid version (because of missing splashscreen bug) plus Linux version. Tried many from cordova: 6.0.0, 6.4.0, 6.5.0; cordova-android: 6.0.0, 6.2.1., 6.2.2, 6.2.3
First I thought it is related to where I build, but now it turns out that this isn't completely true.
Current setup:
Cordova CLI: 6.0.0
Gulp version: CLI version 3.9.1
Gulp local: Local version 3.9.1
Ionic Framework Version: 1.3.0
Ionic CLI Version: 1.7.16
Ionic App Lib Version: 0.7.3
OS: Distributor ID: Ubuntu Description: Ubuntu 17.04
Node Version: v4.4.0
Any help is very much appreciated!
UPDATE: My config.xml
<?xml version='1.0' encoding='utf-8'?>
<widget id="com.myapp" version="0.8.2" xmlns="http://www.w3.org/ns/widgets" xmlns:cdv="http://cordova.apache.org/ns/1.0">
<name>MyApp</name>
<description>
My desc.
</description>
<author email="[email protected]" href="http://myapp.com/">
MyApp Co.
</author>
<content src="index.html" />
<access origin="*" />
<access launch-external="yes" origin="tel:*" />
<allow-intent href="tel:*" />
<plugin name="Geolocation" value="CDVLocation" />
<plugin name="cordova-plugin-network-information" spec="~1.2.1" />
<preference name="webviewbounce" value="false" />
<preference name="UIWebViewBounce" value="false" />
<preference name="DisallowOverscroll" value="true" />
<preference name="android-minSdkVersion" value="16" />
<preference name="BackupWebStorage" value="none" />
<preference name="SplashScreen" value="screen" />
<preference name="SplashScreenDelay" value="7000" />
<preference name="FadeSplashScreenDuration" value="1000" />
<preference name="xwalkVersion" value="19+" />
<preference name="xwalkCommandLine" value="--disable-pull-to-refresh-effect" />
<preference name="xwalkMode" value="embedded" />
<preference name="xwalkMultipleApk" value="true" />
<preference name="StatusBarStyle" value="default" />
<feature name="StatusBar">
<param name="ios-package" onload="true" value="CDVStatusBar" />
</feature>
<hook src="hooks/before_build/010_some_hook.js" type="before_build" />
<hook src="hooks/after_prepare/020_other_hook.js" type="after_prepare" />
<platform name="android">
<splash density="port-ldpi" src="resources/android/splash/drawable-port-ldpi-screen.png" />
<splash density="port-mdpi" src="resources/android/splash/drawable-port-mdpi-screen.png" />
<splash density="port-hdpi" src="resources/android/splash/drawable-port-hdpi-screen.png" />
<splash density="port-xhdpi" src="resources/android/splash/drawable-port-xhdpi-screen.png" />
<splash density="port-xxhdpi" src="resources/android/splash/drawable-port-xxhdpi-screen.png" />
<splash density="port-xxxhdpi" src="resources/android/splash/drawable-port-xxxhdpi-screen.png" />
<icon density="ldpi" src="resources/android/icon/drawable-ldpi-icon.png" />
<icon density="mdpi" src="resources/android/icon/drawable-mdpi-icon.png" />
<icon density="hdpi" src="resources/android/icon/drawable-hdpi-icon.png" />
<icon density="xhdpi" src="resources/android/icon/drawable-xhdpi-icon.png" />
<icon density="xxhdpi" src="resources/android/icon/drawable-xxhdpi-icon.png" />
<icon density="xxxhdpi" src="resources/android/icon/drawable-xxxhdpi-icon.png" />
</platform>
<platform name="ios">
<splash height="1136" src="resources/ios/splash/Default-568h@2x~iphone.png" width="640" />
<splash height="1334" src="resources/ios/splash/Default-667h.png" width="750" />
<splash height="2208" src="resources/ios/splash/Default-736h.png" width="1242" />
<splash height="2048" src="resources/ios/splash/Default-Portrait@2x~ipad.png" width="1536" />
<splash height="2732" src="resources/ios/splash/Default-Portrait@~ipadpro.png" width="2048" />
<splash height="1024" src="resources/ios/splash/Default-Portrait~ipad.png" width="768" />
<splash height="960" src="resources/ios/splash/Default@2x~iphone.png" width="640" />
<splash height="480" src="resources/ios/splash/Default~iphone.png" width="320" />
<icon height="57" src="resources/ios/icon/icon.png" width="57" />
<icon height="114" src="resources/ios/icon/[email protected]" width="114" />
<icon height="40" src="resources/ios/icon/icon-40.png" width="40" />
<icon height="80" src="resources/ios/icon/[email protected]" width="80" />
<icon height="120" src="resources/ios/icon/[email protected]" width="120" />
<icon height="50" src="resources/ios/icon/icon-50.png" width="50" />
<icon height="100" src="resources/ios/icon/[email protected]" width="100" />
<icon height="60" src="resources/ios/icon/icon-60.png" width="60" />
<icon height="120" src="resources/ios/icon/[email protected]" width="120" />
<icon height="180" src="resources/ios/icon/[email protected]" width="180" />
<icon height="72" src="resources/ios/icon/icon-72.png" width="72" />
<icon height="144" src="resources/ios/icon/[email protected]" width="144" />
<icon height="76" src="resources/ios/icon/icon-76.png" width="76" />
<icon height="152" src="resources/ios/icon/[email protected]" width="152" />
<icon height="167" src="resources/ios/icon/[email protected]" width="167" />
<icon height="29" src="resources/ios/icon/icon-small.png" width="29" />
<icon height="58" src="resources/ios/icon/[email protected]" width="58" />
<icon height="87" src="resources/ios/icon/[email protected]" width="87" />
</platform>
<icon src="resources/android/icon/drawable-xhdpi-icon.png" />
<plugin name="cordova-plugin-fcm" spec="~2.1.1" />
<plugin name="cordova-plugin-inappbrowser" spec="~1.7.0" />
<engine name="android" spec="~6.2.1" />
<engine name="ios" spec="~4.3.1" />
<plugin name="cordova-plugin-facebook4" spec="~1.7.4">
<variable name="APP_ID" value="myid" />
<variable name="APP_NAME" value="MyApp" />
</plugin>
</widget>
List of plugins we use:
"cordovaPlugins": [
"cordova-plugin-geolocation",
"cordova-plugin-whitelist",
"cordova-plugin-crosswalk-webview",
"cordova-plugin-splashscreen",
"cordova-plugin-statusbar",
"cordova-plugin-fcm",
"uk.co.workingedge.phonegap.plugin.launchnavigator",
"cordova-plugin-x-toast",
{
"variables": {
"FABRIC_API_KEY": "mykey",
"FABRIC_API_SECRET": "mysecret"
},
"locator": "[email protected]",
"id": "[email protected]"
},
"cordova-plugin-device",
"cordova-plugin-network-information",
"cordova-plugin-inappbrowser",
{
"variables": {
"APP_ID": "myid",
"APP_NAME": "myapp"
},
"locator": "cordova-plugin-facebook4",
"id": "cordova-plugin-facebook4"
},
"cordova-plugin-screen-orientation"
]
We don't recommend using Android Studio for developing Ionic apps. Instead, it should only really be used to build and run your apps for the native Android platform and to manage the Android SDK and virtual devices.
To run your app, all you have to do is enable USB debugging and Developer Mode on your Android device, then run ionic cordova run android --device from the command line. Enabling USB debugging and Developer Mode can vary between devices, but is easy to look up with a Google search.
Setting this preference <preference name="StatusBarOverlaysWebView" value="false" />
on the config.xml, or using this code StatusBar.overlaysWebView(false);
after device ready event might fix your problem.
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