hypery2k / nativescript-urlhandler

NativeScript URL Handler Plugin
MIT License
52 stars 34 forks source link

Android NS 5.4 does not work with android:host="__PACKAGE__" in Manifest #92

Open jalbatross opened 5 years ago

jalbatross commented 5 years ago

Using version 1.3.0 of nativescript-urlhandler

Just a PSA, for whatever reason the plugin did not seem to work with Android when android:host="__PACKAGE__" was included in the AndroidManifest along with the scheme. Removing that particular piece fixes the issue.

Copy of the working element

    <application android:name="com.tns.NativeScriptApplication" android:allowBackup="true" android:icon="@mipmap/ic_launcher" android:label="@string/app_name" android:theme="@style/AppTheme">

        <activity android:name="com.tns.NativeScriptActivity" ... android:launchMode="singleTask">

            <meta-data android:name="SET_THEME_ON_LAUNCH" android:resource="@style/AppTheme" />

            <intent-filter>
                <action android:name="android.intent.action.MAIN" />
                <category android:name="android.intent.category.LAUNCHER" />
            </intent-filter>
            <intent-filter>
                <action android:name="android.intent.action.VIEW" />
                <category android:name="android.intent.category.DEFAULT" />
                <category android:name="android.intent.category.BROWSABLE" />
<!---- Here ----->              <data android:scheme="myappscheme" />  
            </intent-filter>
        </activity>

        <activity android:name="com.tns.ErrorReportActivity" />
    </application>
sylann commented 4 years ago

@jalbatross Hello,

I think __PACKAGE__ is a placeholder. It would be better if someone changed it to a realistic value in the readme.md. It makes sense that it works without it because, declared intents in the manifest seem to mostly specify what is expected and not define any requirement. In fact whenever something is required, it will make the build fail if it's missing (from my very limited experience, so take that with a grain of salt).

Anyway, if you have the package attribute set on the <manifest> node, I think you should use this same value instead of __PACKAGE__, but again, not necessary.

dimitriospafos commented 4 years ago

@jalbatross did you ever solve this? I'm having the same issue. Using NS 6.1. It works on IOS. I tried leaving the default PACKAGE as well as changing it to a custom string as @SylannBin suggested but did not work still

rrr3da commented 4 years ago

@jalbatross i'm having the same issue here. The plugin works well in iOS, but for Chrome nothing happens if we try to open the same link from a browser

dimitriospafos commented 4 years ago

@rrr3da checkout this plugin https://github.com/sebestindragos/nativescript-plugin-universal-links plugin. I had to convert my code to use universal-links instead of deep-links (which needs some extra setup especially for ios) but in the end it worth it. Make sure to check this issue if you are planning to give it a try: https://github.com/sebestindragos/nativescript-plugin-universal-links/issues/3

rrr3da commented 4 years ago

@dimitriospafos thank you for your hint, the plugin you suggested works for Android, but I can't get it work on iOS 🔒 Glad if you can help me with this issue

dimitriospafos commented 4 years ago

@rrr3da seems like you resolved the issue! cheers