Cordova app crashes when ios app has been in background for 7-9 hours. When clicking on a push notification

124 Views Asked by At

I have a angular app which uses cordova for packing it in a native app. Everything works fine except when I click on a push notification when the app has been in the background for 7-9 hours. When this happens the index.html is displayed and nothing else happens. I tried to wrap the bootstrap on angular and the callback of pushNotificationReceived in a try/catch block which is not executed. Which leads me to believe that the angular is not the problem in that case.

Unfortunately I can only reproduce this error only when i wait for 7-9 hours. I suspect that iOS stops the whole process after a certain period of time, but I can't find further information on that.

I found a ticket that sounds kinda similar here: https://github.com/dpa99c/cordova-plugin-firebasex/issues/803 But I can't seem to reproduce the error the way they can.

If anyone knows this bug/error and knows how to fix it or can point me in the right direction would be much appreciated.

Here is my cordova config :

<?xml version='1.0' encoding='utf-8'?>

<widget id="de.app-name.app" version="1.0.0" xmlns="http://www.w3.org/ns/widgets"
    xmlns:cdv="http://cordova.apache.org/ns/1.0" >

<name>AppName</name>
<description>Sample Apache Cordova App</description>
<author email="[email protected]" href="https://cordova.apache.org">
    Apache Cordova Team
</author>
<content src="index.html"/>
<allow-intent href="http://*/*"/>
<allow-intent href="https://*/*"/>

<platform name="android">
    <preference name="AndroidWindowSplashScreenAnimatedIcon" value="res/screen/android/splashscreen-icon.png"/>
    <preference name="AndroidWindowSplashScreenBackground" value="#FFFFFF"/>

    <icon density="ldpi" src="res/icon/android/ldpi.png"/>
    <icon density="mdpi" src="res/icon/android/mdpi.png"/>
    <icon density="hdpi" src="res/icon/android/hdpi.png"/>
    <icon density="xhdpi" src="res/icon/android/xhdpi.png"/>
    <icon density="xxhdpi" src="res/icon/android/xxhdpi.png"/>
    <icon density="xxxhdpi" src="res/icon/android/xxxhdpi.png"/>

    <preference name="StatusBarOverlaysWebView" value="false"/>

    <allow-intent href="market:*"/>
    <preference name="AndroidXEnabled" value="true"/>
    <preference name="android-minSdkVersion" value="26"/>
    <preference name="android-targetSdkVersion" value="33"/>
    <preference name="android-buildToolsVersion" value="33.0.0"/>
</platform>

<platform name="ios">
    <icon src="res/icon/ios/icon-1024.png" width="1024" height="1024"/>
    <icon src="res/icon/ios/icon-small.png" width="29" height="29"/>
    <icon src="res/icon/ios/[email protected]" width="58" height="58"/>
    <icon src="res/icon/ios/[email protected]" width="87" height="87"/>
    <icon src="res/icon/ios/icon-40.png" width="40" height="40"/>
    <icon src="res/icon/ios/[email protected]" width="80" height="80"/>
    <icon src="res/icon/ios/icon-50.png" width="50" height="50"/>
    <icon src="res/icon/ios/[email protected]" width="100" height="100"/>
    <icon src="res/icon/ios/icon.png" width="57" height="57"/>
    <icon src="res/icon/ios/[email protected]" width="114" height="114"/>
    <icon src="res/icon/ios/icon-60.png" width="60" height="60"/>
    <icon src="res/icon/ios/[email protected]" width="120" height="120"/>
    <icon src="res/icon/ios/[email protected]" width="180" height="180"/>
    <icon src="res/icon/ios/icon-72.png" width="72" height="72"/>
    <icon src="res/icon/ios/[email protected]" width="144" height="144"/>
    <icon src="res/icon/ios/icon-76.png" width="76" height="76"/>
    <icon src="res/icon/ios/[email protected]" width="152" height="152"/>
    <icon src="res/icon/ios/icon-167.png" width="167" height="167"/>
    <icon src="res/icon/ios/[email protected]" width="167" height="167"/>

    <splash src="res/screen/ios/Default@2x~iphone~anyany.png"/>
    <splash src="res/screen/ios/Default@2x~iphone~comany.png"/>
    <splash src="res/screen/ios/Default@3x~iphone~anyany.png"/>
    <splash src="res/screen/ios/Default@3x~iphone~comany.png"/>
    <splash src="res/screen/ios/Default@2x~ipad~anyany.png"/>
    <splash src="res/screen/ios/Default@2x~ipad~comany.png"/>

    <preference name="scheme" value="https"/>
    <preference name="hostname" value="localhost"/>
    <preference name="StatusBarBackgroundColor" value="#16697a"/>
    <preference name="deployment-target" value="11.0"/>
</platform>

</widget>

This is my package json

"name": "package",
"displayName": "AppName",
"version": "1.0.0",
"description": "A sample Apache Cordova",
"main": "index.js",
"scripts": {
  "test": "echo \"Error: no test specified\" && exit 1"
},
"keywords": [
  "ecosystem:cordova"
],
"author": "Apache Cordova Team",
"license": "Apache-2.0",
"devDependencies": {
  "cordova": "11.1.0",
  "cordova-android": "11.0.0",
  "cordova-ios": "^6.3.0",
  "cordova-plugin-firebasex": "16.0.0",
  "cordova-plugin-statusbar": "3.0.0"
},
"cordova": {
  "platforms": [
  "android",
  "ios"
],
"plugins": {
  "cordova-plugin-statusbar": {}
  "cordova-plugin-firebasex": {
    "FIREBASE_ANALYTICS_COLLECTION_ENABLED": "true",
    "FIREBASE_PERFORMANCE_COLLECTION_ENABLED": "true",
    "FIREBASE_CRASHLYTICS_COLLECTION_ENABLED": "true",
    "FIREBASE_FCM_AUTOINIT_ENABLED": "true",
    "IOS_USE_PRECOMPILED_FIRESTORE_POD": "false"
  }
}
0

There are 0 best solutions below