Can't open link like "intent://" in android app

Viewed 152

I want to open link like "intent://qr.nspk.ru/url-something/#Intent;scheme=someScheme;package=com.example.android;end#Intent;scheme=someScheme;end" from an android application.

If I write something like this:

val i = Intent(Intent.ACTION_VIEW, Uri.parse(androidUrl))
startActivity(i)

I get this error:

No Activity found to handle Intent { act=android.intent.action.VIEW dat=intent://qr.nspk.ru/url-something/#Intent;scheme=someScheme;package=com.example.android;end#Intent;scheme=someScheme;end

But If I go to this link from browser, it opens and it open an app that I need. Can you help me to understand why I can't open link from app and how to fix it?

1 Answers

The intent: scheme is used for the browser to encode an Android Intent. If you want to use this URL from an Android app, you need to create an Intent from the URL like this:

val i = Intent.parseUri(androidUrl, Intent.URI_INTENT_SCHEME)
startActivity(i)
Related