Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Query: Does unity-webview support intent links? #1126

Open
SH801 opened this issue Jan 2, 2025 · 4 comments
Open

Query: Does unity-webview support intent links? #1126

SH801 opened this issue Jan 2, 2025 · 4 comments

Comments

@SH801
Copy link

SH801 commented Jan 2, 2025

Hi there,

Firstly, congrats on an excellent bit of software - has saved me a whole bunch of time!

For my Unity Android app I'm using Android intents to do deep linking within my app. I was therefore wondering whether unity-webview supports url-based Android intents at all - so clicking on a webview 'intent url' would take me back inside the same app (in a fully webview-host agnostic way)?
https://developer.chrome.com/docs/android/intents#examples

I can potentially achieve my solution using the javascript Unity.__ function but would prefer a tidier solution that just uses url-based intents.

[Apologies in advance if this is already covered in the documentation. ]

Best,

Stefan

@KojiNakamaru
Copy link
Member

I haven't confirmed whether the plugin works for your situation, but the plugin tries to start an activity as below:

Intent intent = new Intent(Intent.ACTION_VIEW, Uri.parse(url));
// PackageManager pm = a.getPackageManager();
// List<ResolveInfo> apps = pm.queryIntentActivities(intent, 0);
// if (apps.size() > 0) {
// view.getContext().startActivity(intent);
// }
try {
view.getContext().startActivity(intent);
} catch (ActivityNotFoundException ex) {
}

@SH801
Copy link
Author

SH801 commented Jan 5, 2025

I did a search on the codebase for the URL scheme "intent://" but nothing came up - so sounds like it probably doesn't handle intents :-(

@KojiNakamaru
Copy link
Member

I adjusted code to treat intent:// in #1128 and updated binaries. Could you please try the latest?

@SH801
Copy link
Author

SH801 commented Jan 5, 2025

Wow, that was quick! Massive thanks for jumping on it so quickly :-)

I'm starting a new job tomorrow so going to be flat out for next few days, but hopefully will have a play with it later this week.

Awesome!!!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants