10.2 C
London
Tuesday, November 21, 2023

android – App freezes after it is opened from push notification – Can’t learn property ‘outlet’ of undefined


Description

Nativescript software with Angular.

We’ve an software with a number of elements which signify screens (e.g.: house display, recap display, picture display, delayed add display). This software permits person to add photos.

Consumer stream goes principally like this:

House display -> Picture display -> Recap display -> “Thank You” display

with slight change if an person is on cellular knowledge, than he’s requested if he desires to delay picture add and if that’s the case, he’s redirected to the “Delayed add” display.

Downside

The issue is that when person navigates from “Delayed add” display to the house display after which he exits app, after clicking on push notification, the app is opened on the house display and fully frozen on each Android or iOS.

This doesn’t occur when person after delaying stays on recap display and exits the app or doesn’t exit the app in any respect.

Error message

  ERROR Error: Uncaught (in promise): TypeError: Can't learn property 'outlet' of undefined
  TypeError: Can't learn property 'outlet' of undefined
      at NSLocationStrategy.getRouteFullPath (file: srcwebpack:@davinciunion-mobile-appnode_modules@nativescriptangularfesm2015nativescript-angular.mjs:3608:40)
      at NSRouteReuseStrategy.findValidOutletAndKey (file: srcwebpack:@davinciunion-mobile-appnode_modules@nativescriptangularfesm2015nativescript-angular.mjs:5826:45)
      at NSRouteReuseStrategy.shouldDetach (file: srcwebpack:@davinciunion-mobile-appnode_modules@nativescriptangularfesm2015nativescript-angular.mjs:5804:32)
      at ActivateRoutes.deactivateRouteAndItsChildren (file: srcwebpack:@davinciunion-mobile-appnode_modules@angularrouterfesm2015router.mjs:2919:61)
      at file: srcwebpack:@davinciunion-mobile-appnode_modules@angularrouterfesm2015router.mjs:2889:17
      at forEach (file: srcwebpack:@davinciunion-mobile-appnode_modules@angularrouterfesm2015router.mjs:181:12)
      at ActivateRoutes.deactivateChildRoutes (file: srcwebpack:@davinciunion-mobile-appnode_modules@angularrouterfesm2015router.mjs:2888:8)
      at ActivateRoutes.deactivateRoutes (file: srcwebpack:@davinciunion-mobile-appnode_modules@angularrouterfesm2015router.mjs:2901:25)
      at file:///knowledge/knowledge/sk.union.kasko.d...

Atmosphere:

OS: Home windows 11 10.0.22631
CPU: (8) x64 Intel(R) Core(TM) i7-8565U CPU @ 1.80GHz
Shell: Not Discovered
node: 16.16.0
npm: 8.17.0
nativescript: Not Discovered

# android
java: Not Discovered
ndk: Not Discovered
apis: 26, 32, 33
build_tools: 30.0.3, 31.0.0, 31.0.0, 32.0.0, 32.1.0, 33.0.0
system_images:
  - android-26 | Google Play Intel x86 Atom
  - android-29 | Google Play Intel x86 Atom
  - android-30 | Google APIs Intel x86 Atom
  - android-32 | Google Play Intel x86 Atom_64

# ios
xcode: Not Discovered
cocoapods: Not Discovered
python: Not Discovered
python3: Not Discovered
ruby: Not Discovered
platforms: Not Discovered

Code

    scheduleDelayedUploadAlert(): void {
        LocalNotifications.requestPermission()
            .then(() => {
                LocalNotifications.schedule([{
                    id: this.DELAYED_UPLOAD_NOTIFICATION_ID,
                    title: this.translate.instant('notifications.delayedUpload.title'),
                    body: this.translate.instant('notifications.delayedUpload.body'),
                    ongoing: true,
                    at: moment().add(1, 'minutes').toDate()
                }]).then((scheduledIds) => {
                    console.log('Notification id(s) scheduled: ' + JSON.stringify(scheduledIds));
                }, (error) => {
                    console.log('scheduling error: ' + error);
                });

                LocalNotifications.addOnMessageReceivedCallback((notification) => {
                    console.log('Notification addOnMessageReceivedCallback, ID: ' + notification.id);
                    if (notification.id) {
                        timeModule.setTimeout(() => {
                            this.ngZone.run(() => {
                                console.log('Redirecting from notification name again to delayed add display');
                                this.router.navigate(['/selfInspection/delayedUpload']);
                            });
                        });
                    }
                }).then(() => {
                        console.log('Listener added');
                    }
                );
            }).catch((error) => {
            console.error('No permission for notification');
            console.error(error);
        });
    }

Exams

I attempted totally different variations of each Nativescript and Angular:

"dependencies": {
    "@angular/animations": "~14.2.0",
    "@angular/frequent": "~14.2.0",
    "@angular/compiler": "~14.2.0",
    "@angular/core": "~14.2.0",
    "@angular/types": "~14.2.0",
    "@angular/platform-browser": "~14.2.0",
    "@angular/platform-browser-dynamic": "~14.2.0",
    "@angular/router": "~14.2.0",
    "@nativescript/angular": "~14.2.0",
    "@nativescript/core": "~8.4.7",
    "@nativescript/theme": "~3.0.2",
    "@nativescript/appversion": "~2.0.0",
    "@nativescript/background-http": "^6.0.0",
    "@nativescript/digicam": "^5.0.15",
    "@nativescript/geolocation": "^8.1.0",
    "@nativescript/local-notifications": "^6.0.0",
    "@ngx-translate/core": "^14.0.0",
    "@nstudio/nativescript-loading-indicator": "^4.2.0",
    "second": "^2.29.1",
    "nativescript": "^8.4.0",
    "nativescript-clipboard": "^2.0.0",
    "nativescript-permissions": "^1.3.12",
    "reflect-metadata": "~0.1.12",
    "rxjs": "~7.5.0",
    "zone.js": "~0.11.5"
  },
  "devDependencies": {
    "@angular-devkit/build-angular": "~14.2.0",
    "@angular/compiler-cli": "~14.2.0",
    "@nativescript/android": "~8.4.0",
    "@nativescript/ios": "8.4.0",
    "@nativescript/varieties": "~8.4.0",
    "@nativescript/webpack": "~5.0.6",
    "@ngtools/webpack": "~14.2.0",
    "typescript": "~4.7.0",
    "codelyzer": "~6.0.0",
    "cross-env": "^7.0.3",
    "fs-extra": "^9.0.1",
    "nativescript-dev-typescript": "~0.7.0",
    "platform-detect": "^3.0.1",
    "sass": "~1.39.0",
    "tslint": "~6.1.3"
  },

or

 "dependencies": {
    "@angular/animations": "~16.2.12",
    "@angular/frequent": "~16.2.12",
    "@angular/compiler": "~16.2.12",
    "@angular/core": "~16.2.12",
    "@angular/types": "~16.2.12",
    "@angular/platform-browser": "~16.2.12",
    "@angular/platform-browser-dynamic": "~16.2.12",
    "@angular/router": "~16.2.12",
    "@nativescript/angular": "^16.0.1",
    "@nativescript/core": "~8.6.1",
    "@nativescript/theme": "~3.0.2",
    "@nativescript/appversion": "~2.0.0",
    "@nativescript/background-http": "^6.0.0",
    "@nativescript/digicam": "^5.0.15",
    "@nativescript/geolocation": "^8.1.0",
    "@nativescript/local-notifications": "^6.1.1",
    "@ngx-translate/core": "^14.0.0",
    "@nstudio/nativescript-loading-indicator": "^4.2.0",
    "second": "^2.29.1",
    "nativescript": "^8.4.0",
    "nativescript-clipboard": "^2.0.0",
    "nativescript-permissions": "^1.3.12",
    "reflect-metadata": "~0.1.12",
    "rxjs": "~7.8.0",
    "zone.js": "~0.13.0"
  },
  "devDependencies": {
    "@angular-devkit/build-angular": "~16.2.10",
    "@angular/compiler-cli": "~16.2.12",
    "@nativescript/varieties": "~8.6.1",
    "@nativescript/webpack": "~5.0.18",
    "@ngtools/webpack": "~16.2.10",
    "@nativescript/android": "~8.6.2",
    "@nativescript/ios": "8.4.0",
    "typescript": "~5.1.6",
    "codelyzer": "~6.0.0",
    "cross-env": "^7.0.3",
    "fs-extra": "^9.0.1",
    "nativescript-dev-typescript": "~0.7.0",
    "platform-detect": "^3.0.1",
    "sass": "~1.39.0",
    "tslint": "~6.1.3"
  },

on a number of iOS and Android gadgets leading to similar conduct and error.

Anticipated conduct

After clicking on push notification, person needs to be redirected to the “Delayed add” display and app should not be frozen on house display.

Latest news
Related news

LEAVE A REPLY

Please enter your comment!
Please enter your name here