ionic 3.14.0
Universal link works well.
Any idea why it won’t match even though the log shows the correct path?
This is the link I’m trying: mysnapp://shows/123
this is the log:
console.error: Got a deeplink that didn't match: error opening ws message:
console.error:
Got a deeplink that didn't match:
error opening ws message:
{
"category":"console",
"type":"log",
"data":["Ondeeplink",
{"path":"/123",
"queryString":"",
"fragment":"",
"host":"show",
"url":"mysnapp://show/123",
"scheme":"mysnapp"}]
}
code used:
this.deeplinks.route({
'/home': HomePage,
'/show/:showID': ShowsPage,
'/product/:productID': ProductPage
}).subscribe((match) => {
//
}, (nomatch) => {
console.error('Got a deeplink that didn\'t match: ' + nomatch.$link);
});
Try maybe adding app/
in your url
mysnapp://app/shows/123
tried that already, same thing… even tried multiple options (/show, /app/show, etc…) to cover it all, nothing seems to work:
error opening ws message: {"category":"console","type":"log","data":["On deeplink",{"path":"/show/111","queryString":"","fragment":"","host":"app","url":"mysnapp://app/show/111","scheme":"mysnapp"}]}
How does your config.xml looks like?
I’ve got
<plugin name="ionic-plugin-deeplinks" spec="^1.0.15">
<variable name="URL_SCHEME" value="mysnapp" />
<variable name="DEEPLINK_SCHEME" value="https" />
<variable name="DEEPLINK_HOST" value="mywebsite.com" />
<variable name="ANDROID_PATH_PREFIX" value="/" />
<variable name="ANDROID_2_PATH_PREFIX" value="/" />
<variable name="ANDROID_3_PATH_PREFIX" value="/" />
<variable name="ANDROID_4_PATH_PREFIX" value="/" />
<variable name="ANDROID_5_PATH_PREFIX" value="/" />
<variable name="DEEPLINK_2_SCHEME" value=" " />
<variable name="DEEPLINK_2_HOST" value=" " />
<variable name="DEEPLINK_3_SCHEME" value=" " />
<variable name="DEEPLINK_3_HOST" value=" " />
<variable name="DEEPLINK_4_SCHEME" value=" " />
<variable name="DEEPLINK_4_HOST" value=" " />
<variable name="DEEPLINK_5_SCHEME" value=" " />
<variable name="DEEPLINK_5_HOST" value=" " />
</plugin>
also do you try on iOS? (I personally think it works better on iOS than Android…)
Also did you initialize your deep links when app is ready?
this.platform.ready().then(() => {
this.deeplinks.route({
'/home': HomePage,
'/show/:showID': ShowsPage,
'/product/:productID': ProductPage
}).subscribe((match) => {
//
}, (nomatch) => {
console.error('Got a deeplink that didn\'t match: ' + nomatch.$link);
});
});
And finally, do you app use a Facebook login?
May sounds not relevant but I just had to build a workaround. After Facebook login, using cordova-plugin-facebook4, if you want deep linking to still match you would have to do the initialization again
@reedrichards I do have facebook4 on the app but I’m testing without login in, does this change anything?
Not really, I mean if you do a Facebook login and don’t close your app, yes. If you did a Fb login and did restart the app without doing the FB login again, no.
But here my workaround just in case, maybe it deserve a try? As you see, to init again I just call the same method when there is a nomatch.
private initializeDeepLinking() {
this.platform.ready().then(() => {
this.deeplinks.route({
}).subscribe((match) => {
//
}, (nomatch) => {
// HACK: Init again after nomatch from Facebook login
this.initializeDeepLinking();
});
For anyone having issue with this, I got it working with:
this.deeplinks.routeWithNavController(…
no luck with deeplonks.route…
1 Like
@christianpugliese bravo, congrats for finding it!
sorry I didn’t saw that, I use .route
and in my case it’s working, maybe there is a difference because I use LazyLoading? Anyway cool to know you found the solution right before the weekend 
Try
mysnapp://mywebsite.com/shows/123