First app start after download from Store - different than later app starts?

I need your help… Is there anything different or special about the first start of an Ionic Android app after installing it from Play Store?

I have issues with my app not loading the map properly, not navigating to another page correctly and stuff like that, which only seems to happen on the first app start ever on a device. When the app is forced to close and restarted, everything works like a charm…

Are you using Ionic Deploy of Ionic Pro?

What is your ionic info output?

Hi @Sujan12. Thanks for your reply!

No, I do not use Ionic Deploy. I deploy the way it’s described in the Ionic documentation.

My ionic info output:

cli packages:

    @ionic/cli-utils  : 1.19.0
    ionic (Ionic CLI) : 3.19.0

global packages:

    cordova (Cordova CLI) : 7.1.0

local packages:

    @ionic/app-scripts : 3.1.2
    Cordova Platforms  : android 6.3.0 ios 4.5.4
    Ionic Framework    : ionic-angular 3.8.0

System:

    Android SDK Tools : 25.2.5
    Node              : v8.2.1
    npm               : 5.5.1
    OS                : Windows 10

What does your package.json look like?

Thank you for looking into this!!

package.json:

{
  "name": "...",
  "author": "...",
  "homepage": "...",
  "private": true,
  "scripts": {
    "clean": "ionic-app-scripts clean",
    "build": "ionic-app-scripts build",
    "ionic:build": "ionic-app-scripts build",
    "ionic:serve": "ionic-app-scripts serve"
  },
  "dependencies": {
    "@angular/animations": "4.4.4",
    "@angular/common": "4.4.4",
    "@angular/compiler": "4.4.4",
    "@angular/compiler-cli": "4.4.4",
    "@angular/core": "4.4.4",
    "@angular/forms": "4.4.4",
    "@angular/http": "4.4.4",
    "@angular/platform-browser": "4.4.4",
    "@angular/platform-browser-dynamic": "4.4.4",
    "@angular/platform-server": "4.4.4",
    "@angular/router": "4.4.4",
    "@ionic-native/app-minimize": "^4.2.1",
    "@ionic-native/app-version": "^4.1.0",
    "@ionic-native/core": "^4.3.1",
    "@ionic-native/device": "^4.1.0",
    "@ionic-native/facebook": "^4.1.0",
    "@ionic-native/firebase-analytics": "^4.4.2",
    "@ionic-native/geolocation": "^4.1.0",
    "@ionic-native/google-maps": "^4.4.2",
    "@ionic-native/google-plus": "^4.1.0",
    "@ionic-native/in-app-browser": "^4.5.2",
    "@ionic-native/keyboard": "^4.3.2",
    "@ionic-native/spinner-dialog": "^4.1.0",
    "@ionic-native/splash-screen": "^4.1.0",
    "@ionic-native/status-bar": "^4.4.2",
    "@ionic-native/vibration": "^4.1.0",
    "@ionic/storage": "^2.0.1",
    "@types/google-maps": "^3.2.0",
    "@types/googlemaps": "^3.26.14",
    "@types/phonegap-plugin-push": "^2.0.0",
    "ajv": "^5.3.0",
    "angularfire2": "^4.0.0-rc.1",
    "angularfire2-offline": "^4.3.1",
    "cordova": "^7.0.1",
    "cordova-android": "6.3.0",
    "cordova-plugin-app-version": "^0.1.9",
    "cordova-plugin-appminimize": "^1.0.0",
    "cordova-plugin-crosswalk-webview": "^2.3.0",
    "cordova-plugin-device": "^1.1.6",
    "cordova-plugin-email-composer": "^0.8.12",
    "cordova-plugin-facebook4": "^1.9.1",
    "cordova-plugin-firebase-analytics": "^0.12.1",
    "cordova-plugin-geolocation": "^3.0.0",
    "cordova-plugin-googlemaps": "^2.1.1",
    "cordova-plugin-googlemaps-sdk": "git+https://github.com/mapsplugin/cordova-plugin-googlemaps-sdk.git",
    "cordova-plugin-googleplus": "^5.1.1",
    "cordova-plugin-inappbrowser": "^2.0.1",
    "cordova-plugin-ionic-webview": "^1.1.16",
    "cordova-plugin-native-spinner": "^1.1.3",
    "cordova-plugin-splashscreen": "^4.0.3",
    "cordova-plugin-statusbar": "^2.3.0",
    "cordova-plugin-vibration": "^2.1.5",
    "cordova-plugin-whitelist": "^1.3.2",
    "cordova-support-google-services": "^1.0.0",
    "firebase": "^4.4.0",
    "hyphenation.de": "^0.2.1",
    "hypher": "^0.2.5",
    "ionic-angular": "^3.8.0",
    "ionic-plugin-keyboard": "^2.2.1",
    "ionic2-super-tabs": "^4.1.4",
    "ionicons": "3.0.0",
    "ios-sim": "^6.0.0",
    "moment": "^2.18.1",
    "phonegap-plugin-push": "^2.1.2",
    "promise-polyfill": "6.0.2",
    "rxjs": "5.4.3",
    "sw-toolbox": "3.6.0",
    "typescript": "2.3.4",
    "webpack": "^3.8.1",
    "zone.js": "0.8.18",
    "cordova-ios": "~4.5.4"
  },
  "devDependencies": {
    "@angular/cli": "^1.0.3",
    "@ionic/app-scripts": "^3.1.2",
    "ionic": "3.19.0"
  },
  "cordovaPlugins": [
    {
      "locator": "phonegap-plugin-push"
    },
    "cordova-plugin-whitelist",
    "cordova-plugin-console",
    "cordova-plugin-statusbar",
    "cordova-plugin-device",
    "cordova-plugin-splashscreen",
    "ionic-plugin-keyboard",
    "cordova-plugin-native-spinner"
  ],
  "cordovaPlatforms": [],
  "description": "...",
  "cordova": {
    "platforms": [
      "android",
      "ios"
    ],
    "plugins": {
      "cordova-plugin-device": {},
      "cordova-plugin-splashscreen": {},
      "cordova-plugin-statusbar": {},
      "cordova-plugin-vibration": {},
      "cordova-plugin-whitelist": {},
      "ionic-plugin-keyboard": {},
      "cordova-plugin-facebook4": {
        "APP_ID": "...",
        "APP_NAME": "..."
      },
      "cordova-plugin-googleplus": {
        "REVERSED_CLIENT_ID": "..."
      },
      "cordova-plugin-native-spinner": {},
      "cordova-plugin-app-version": {},
      "cordova-plugin-geolocation": {
        "GEOLOCATION_USAGE_DESCRIPTION": "..."
      },
      "cordova-plugin-appminimize": {},
      "cordova-plugin-crosswalk-webview": {
        "XWALK_VERSION": "23+",
        "XWALK_LITEVERSION": "xwalk_core_library_canary:17+",
        "XWALK_COMMANDLINE": "--disable-pull-to-refresh-effect",
        "XWALK_MODE": "embedded",
        "XWALK_MULTIPLEAPK": "true"
      },
      "cordova-plugin-googlemaps": {
        "API_KEY_FOR_ANDROID": "...",
        "API_KEY_FOR_IOS": "...",
        "LOCATION_WHEN_IN_USE_DESCRIPTION": "...",
        "LOCATION_ALWAYS_USAGE_DESCRIPTION": "..."
      },
      "cordova-plugin-ionic-webview": {},
      "cordova-support-google-services": {},
      "phonegap-plugin-push": {
        "FCM_VERSION": "11.0.1"
      },
      "cordova-plugin-inappbrowser": {},
      "cordova-plugin-email-composer": {},
      "cordova-plugin-firebase-analytics": {
        "FIREBASE_VERSION": "11.0.+"
      }
    }
  },
  "config": {
    "ionic_purge_unused_fonts": false
  }
}

Seems to happen on iOS as well… Not only Android.

Suspect your app is updating from Ionic Deploy.

To test:

  • Reinstall your app
  • Go into airplane mode
  • Open your app
  • Force close your app
  • Reopen your app

If it’s the same version then I suspect the APK/IPA you deployed to the stores is based on an older JS codebase and is being updated with Ionic Deploy.

hi @Judgewest2000: thanks for your suggestion. However, as said before, I do not use Ionic deploy, but the common way it’s described in the Ionic documentation.

Can we see your config.xml?

Sure

config.xml:

<?xml version='1.0' encoding='utf-8'?>
<widget android-versionCode="2" id="..." ios-CFBundleVersion="2" version="1.0.1" xmlns="http://www.w3.org/ns/widgets" xmlns:cdv="http://cordova.apache.org/ns/1.0">
    <name>...</name>
    <description>...</description>
    <author email="..." href="...">...</author>
    <content src="index.html" />
    <access origin="*" />
    <allow-navigation href="http://ionic.local/*" />
    <allow-navigation href="http://192.168.178.45:8100" />
    <allow-navigation href="http://192.168.178.45:8101" />
    <allow-intent href="http://*/*" />
    <allow-intent href="https://*/*" />
    <allow-intent href="tel:*" />
    <allow-intent href="sms:*" />
    <allow-intent href="mailto:*" />
    <allow-intent href="geo:*" />
    <platform name="android">
        <allow-intent href="market:*" />
        <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" />
        <splash density="land-ldpi" src="resources/android/splash/drawable-land-ldpi-screen.png" />
        <splash density="land-mdpi" src="resources/android/splash/drawable-land-mdpi-screen.png" />
        <splash density="land-hdpi" src="resources/android/splash/drawable-land-hdpi-screen.png" />
        <splash density="land-xhdpi" src="resources/android/splash/drawable-land-xhdpi-screen.png" />
        <splash density="land-xxhdpi" src="resources/android/splash/drawable-land-xxhdpi-screen.png" />
        <splash density="land-xxxhdpi" src="resources/android/splash/drawable-land-xxxhdpi-screen.png" />
        <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" />
        <resource-file src="google-services.json" target="google-services.json" />
    </platform>
    <platform name="ios">
        <allow-intent href="itms:*" />
        <allow-intent href="itms-apps:*" />
        <icon height="57" src="resources/ios/icon/icon.png" width="57" />
        <icon height="114" src="resources/ios/icon/icon@2x.png" width="114" />
        <icon height="40" src="resources/ios/icon/icon-40.png" width="40" />
        <icon height="80" src="resources/ios/icon/icon-40@2x.png" width="80" />
        <icon height="120" src="resources/ios/icon/icon-40@3x.png" width="120" />
        <icon height="50" src="resources/ios/icon/icon-50.png" width="50" />
        <icon height="100" src="resources/ios/icon/icon-50@2x.png" width="100" />
        <icon height="60" src="resources/ios/icon/icon-60.png" width="60" />
        <icon height="120" src="resources/ios/icon/icon-60@2x.png" width="120" />
        <icon height="180" src="resources/ios/icon/icon-60@3x.png" width="180" />
        <icon height="72" src="resources/ios/icon/icon-72.png" width="72" />
        <icon height="144" src="resources/ios/icon/icon-72@2x.png" width="144" />
        <icon height="76" src="resources/ios/icon/icon-76.png" width="76" />
        <icon height="152" src="resources/ios/icon/icon-76@2x.png" width="152" />
        <icon height="167" src="resources/ios/icon/icon-83.5@2x.png" width="167" />
        <icon height="29" src="resources/ios/icon/icon-small.png" width="29" />
        <icon height="58" src="resources/ios/icon/icon-small@2x.png" width="58" />
        <icon height="87" src="resources/ios/icon/icon-small@3x.png" width="87" />
        <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="1242" src="resources/ios/splash/Default-Landscape-736h.png" width="2208" />
        <splash height="1536" src="resources/ios/splash/Default-Landscape@2x~ipad.png" width="2048" />
        <splash height="2048" src="resources/ios/splash/Default-Landscape@~ipadpro.png" width="2732" />
        <splash height="768" src="resources/ios/splash/Default-Landscape~ipad.png" width="1024" />
        <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="1024" src="resources/ios/icon/icon-1024.png" width="1024" />
        <splash height="2732" src="resources/ios/splash/Default@2x~universal~anyany.png" width="2732" />
        <resource-file src="GoogleService-Info.plist" />
    </platform>
    <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="SplashMaintainAspectRatio" value="true" />
    <preference name="AutoHideSplashScreen" value="false" />
    <preference name="FadeSplashScreenDuration" value="500" />
    <preference name="SplashShowOnlyFirstTime" value="false" />
    <preference name="SplashScreen" value="screen" />
    <preference name="SplashScreenDelay" value="10000" />
    <preference name="xwalkZOrderOnTop" value="true" />
    <preference name="BackgroundColor" value="0" />
    <feature name="StatusBar">
        <param name="ios-package" onload="true" value="CDVStatusBar" />
    </feature>
    <edit-config file="*-Info.plist" mode="merge" target="NSLocationWhenInUseUsageDescription">
        <string>...</string>
    </edit-config>
    <engine name="android" spec="6.3.0" />
    <engine name="ios" spec="~4.5.4" />
    <plugin name="cordova-plugin-device" spec="^1.1.6" />
    <plugin name="cordova-plugin-splashscreen" spec="^4.0.3" />
    <plugin name="cordova-plugin-statusbar" spec="^2.3.0" />
    <plugin name="cordova-plugin-vibration" spec="^2.1.5" />
    <plugin name="cordova-plugin-whitelist" spec="^1.3.2" />
    <plugin name="ionic-plugin-keyboard" spec="^2.2.1" />
    <plugin name="cordova-plugin-facebook4" spec="^1.9.1">
        <variable name="APP_ID" value="..." />
        <variable name="APP_NAME" value="..." />
    </plugin>
    <plugin name="cordova-plugin-googleplus" spec="^5.1.1">
        <variable name="REVERSED_CLIENT_ID" value="..." />
    </plugin>
    <plugin name="cordova-plugin-native-spinner" spec="^1.1.3" />
    <plugin name="cordova-plugin-app-version" spec="^0.1.9" />
    <plugin name="cordova-plugin-geolocation" spec="^3.0.0">
        <variable name="GEOLOCATION_USAGE_DESCRIPTION" value="..." />
    </plugin>
    <plugin name="cordova-plugin-appminimize" spec="^1.0.0" />
    <plugin name="cordova-plugin-crosswalk-webview" spec="^2.3.0">
        <variable name="XWALK_VERSION" value="23+" />
        <variable name="XWALK_LITEVERSION" value="xwalk_core_library_canary:17+" />
        <variable name="XWALK_COMMANDLINE" value="--disable-pull-to-refresh-effect" />
        <variable name="XWALK_MODE" value="embedded" />
        <variable name="XWALK_MULTIPLEAPK" value="true" />
    </plugin>
    <plugin name="cordova-plugin-googlemaps" spec="^2.1.1">
        <variable name="API_KEY_FOR_ANDROID" value="..." />
        <variable name="API_KEY_FOR_IOS" value="..." />
        <variable name="LOCATION_WHEN_IN_USE_DESCRIPTION" value="..." />
        <variable name="LOCATION_ALWAYS_USAGE_DESCRIPTION" value="..." />
    </plugin>
    <plugin name="cordova-plugin-ionic-webview" spec="^1.1.16" />
    <plugin name="cordova-support-google-services" spec="^1.0.0" />
    <plugin name="phonegap-plugin-push" spec="^2.1.2">
        <variable name="FCM_VERSION" value="11.0.1" />
    </plugin>
    <plugin name="cordova-plugin-inappbrowser" spec="^2.0.1" />
    <plugin name="cordova-plugin-email-composer" spec="^0.8.12" />
    <plugin name="cordova-plugin-firebase-analytics" spec="^0.12.1">
        <variable name="FIREBASE_VERSION" value="11.0.+" />
    </plugin>
</widget>

Hi, you’re definitely not using any push kind of technology from what I can see which is great.

Are you experiencing the same issue when you’re deploying your APK locally?

The fact that it’s a common problem between both Android / iOS leads me to think perhaps you have a local storage / firebase issue where your application is relying on some data to be there that isn’t (null / undefined type thing) BUT by the second time you run it you do have that data in place.

It’s up to you but if you want to share your repo with us, I’d be happy to take a look.

My git account is judgewest2000

Otherwise let me know if anything from above is useful.

1 Like

@Judgewest2000: I didn’t experience this before uploading the app to the stores…
Maybe you are right with your firebase approach… Maybe it is connected to the angularfire2-offline plugin?

Thank you for your offer to look into my code. I highly appreciate this! I host the project on bitbucket and sent you a private message asking for your emailadress.