nativescript-urlhandler icon indicating copy to clipboard operation
nativescript-urlhandler copied to clipboard

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

Open jalbatross opened this issue 6 years ago • 6 comments

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>

jalbatross avatar Sep 12 '19 17:09 jalbatross

@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.

sylann avatar Nov 13 '19 17:11 sylann

@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

dimitriospafos avatar Apr 12 '20 23:04 dimitriospafos

@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

rrr3da avatar Jun 26 '20 17:06 rrr3da

@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

dimitriospafos avatar Jun 28 '20 15:06 dimitriospafos

@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

rrr3da avatar Jun 29 '20 12:06 rrr3da

@rrr3da seems like you resolved the issue! cheers

dimitriospafos avatar Jun 30 '20 01:06 dimitriospafos