After facing compatibility issues with the Ionic Deeplink plugin ionic-plugin-deeplinks on iOS, I had to resort to installing another plugin called cordova-deeplink, along with cordova-universal0links-plugin. Here is my package.json configuration:
"@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>
Although everything works fine on android, I encountered an issue on iOS where the app only functions correctly when running in the background. When I terminate the app and click on a shared link, it opens the home page of the app instead of navigating to the specific details as expected.
Ionic:
- ionic (Ionic CLI) : 4.0.2
- Ionic Framework : ionic-angular
- 3.9.2 @ionic/app-scripts : 3.2.0
Cordova:
- cordova (Cordova CLI) : 8.1.2 ([email protected])
- Cordova Platforms : not available
System:
- Android SDK Tools : 25.2.5
- NodeJS : v8.9.3
- npm : 5.4.2
- OS : Windows 10