deeplink works when the app in background but none when it's killed

1.1k views Asked by At

i'm using ionic deeplink plugin ionic-plugin-deeplinks it works fine for android, but as it didn't work on ios i forced to install another plugin cordova-deeplink, and cordova-universal0links-plugin. package.json:

"@ionic-native/deeplinks": "^4.16.0",

"cordova-deeplink":"git+https://github.com/foneclay/cordova-universal-links-plugin.git#2.3.1", "cordova-universal-links-plugin": "1.2.1" so in my component.ts:

platform.ready().then(() => {
      if (this.platform.is('android')) {
        this.deeplinks.routeWithNavController(this.nav, {
          '/e-training/course_overview/:courseID': CourseDetailsPage,
           .......
        }).subscribe((match) => {
          console.log('Successfully routed', match);
        }, (nomatch) => {
          console.log('Unmatched Route', nomatch);
        });
      } else {
        if (this.platform.is('ios')) {
          universalLinks.subscribe('openApp', this.onAppRequest.bind(this));
          universalLinks.subscribe('openPage', this.onPageRequest.bind(this));
        }
      }
    });

config.xml:

<universal-links>
        <host event="openApp" name="example.com" scheme="https">
            <path event="openPage" url="/" />
        </host>
</universal-links>

everything work fine on android but in ios only works when the app still in background, when i kill the app (terminate it) and click on any link that i shared through the app it open the home page of the app , didn't go deep inside the details.

Ionic:

  • ionic (Ionic CLI) : 4.0.2
  • Ionic Framework : ionic-angular
  • 3.9.2 @ionic/app-scripts : 3.2.0

Cordova:

System:

  • Android SDK Tools : 25.2.5
  • NodeJS : v8.9.3
  • npm : 5.4.2
  • OS : Windows 10
1

There are 1 answers

0
Joe Sleiman On

I just removed the cordova-deeplink and cordova-universal-links-plugin plugin and everything related to them: like I removed the tags <universal-links>....</universal-links> in config.xml and the code in app.component.ts related to ios section and replaced them by this:

//this.platform.is('android') || this.platform.is('ios')
this.deeplinks.routeWithNavController(this.nav, {
  '/e-training/course_overview/:courseID': CourseDetailsPage,
     ...
  }).subscribe((match) => {
    console.log('Successfully routed', match);
  }, (nomatch) => {
    console.log('Unmatched Route', nomatch);
  });