nordnet / cordova-universal-links-plugin

[DEPRECATED] - Cordova plugin to support Universal/Deep Links for iOS/Android.
https://github.com/nordnet/cordova-universal-links-plugin/issues/160
MIT License
349 stars 530 forks source link

Events fired in Android only locally #149

Closed lcaprini closed 6 years ago

lcaprini commented 6 years ago

Hi, I've installed the plugin on my app and I'm using Google Firebase's Deeplink feature, and on iOS all works perfectly, but on Android platform I've a strange behaviour.

First of all, my config.xml plugin section is:

<universal-links>
    <host name="r123u.app.goo.gl" scheme="https">
        <path event="ul_eventcode" url="/eventcode" />
        <path event="ul_agenda" url="/agenda" />
    </host>
</universal-links>

I've installed the app on my real device using

cordova run android

and after that I've used the

adb shell am start -W -a android.intent.action.VIEW -d "https://r123u.app.goo.gl/eventcode?code=1234" it.test.myapp.

All works fine: the device launches the app and the ul_eventcode event is fired (I'm showing an alert with "Event Code 1234" to test it).

So I copied the url and I pasted it in websites field in my contact inside the Contacts app. Now if I tap on the link, the app will be opened, but no events are fired.

Can you help me?

Thanks, --Luca

lcaprini commented 6 years ago

Hi again, I'm debugging the native plugin's code and I found the line where the plugin stops to work.

UniversalLinksPlugin.java:183

// if app was not launched by the url - ignore
if (!Intent.ACTION_VIEW.equals(action) || launchUri == null) {
return;
}

When I open link from Contacts app the value of action is "android.intent.action.MAIN", so the condition will be verified and plugin returns nothing.

I checked the AndroidManifest.xml file but seems to be correct:

...
<intent-filter android:autoVerify="true">
    <action android:name="android.intent.action.VIEW"/>
    <category android:name="android.intent.category.DEFAULT"/>
    <category android:name="android.intent.category.BROWSABLE"/>
    <data android:host="r123u.app.goo.gl" android:scheme="https" android:path="/eventcode"/>
</intent-filter>
<intent-filter android:autoVerify="true">
    <action android:name="android.intent.action.VIEW"/>
    <category android:name="android.intent.category.DEFAULT"/>
    <category android:name="android.intent.category.BROWSABLE"/>
    <data android:host="r123u.app.goo.gl" android:scheme="https" android:path="/agenda"/>
</intent-filter>
...

How can I "set" the action to "android.intent.action.VIEW" as local tests?

Thanks, --Luca

nordnet-deprecation-bot commented 6 years ago

👋 Hi! Thank you for your interest in this repo.

😢 We are not using nordnet/cordova-universal-links-plugin anymore, and we lack the manpower and the experience needed to maintain it. We are aware of the inconveniece that this may cause you. Feel free to use it as is, or create your own fork.

🔒 This will now be closed & locked.

ℹ️ Please see #160 for more information.