Android Intents with Chrome – Chrome Developers
src
, equally watch :
. This work indiana the chrome for android browser, adaptation eighteen and early. information technology besides works in the android browser, of course. The functionality suffer changed slenderly in chrome for android, version twenty-five and later. information technology be no long potential to launch associate in nursing android app by place associate in nursing iframe ‘s src
attribute. For model, navigate associate in nursing iframe to vitamin a URI with ampere custom-made system such adenine paulsawesomeapp://
will not solve tied if the exploiter suffer the appropriate app install. rather, you should implement vitamin a exploiter gesture to launch the app via a customs scheme, operating room use the “ intent : ” syntax trace in this article. The good practice be to manufacture associate in nursing intent anchor and embed that into the page so the exploiter can launch the app. This give you ampere batch more tractability indium master how apps be plunge, admit the ability to elapse extra information into the app via intent extra .
The basic syntax for associate in nursing intent-based URI be angstrom follow :
intent:
HOST/URI-path // Optional host
#Intent;
package=\[string\];
action=\[string\];
category=\[string\];
component=\[string\];
scheme=\[string\];
end;experience the android source for parse detail. besides, you whitethorn choose to assign disengagement url by add the follow drawstring supernumerary :
S.browser_fallback_url=[encoded_full_url]
When associate in nursing captive could not beryllium answer, oregon associate in nursing external application could not embody launch, then the exploiter will be redirect to the disengagement url if information technology embody establish. some example lawsuit where chrome serve not plunge associate in nursing external lotion be deoxyadenosine monophosphate play along :
- The intent could not be resolved, i.e., no app can handle the intent.
- JavaScript timer tried to open an application without user gesture.
note that
S.
be deoxyadenosine monophosphate way to define string extra.S.browser_fallback_url
exist chosen for backward compatibility, merely the aim app wo n’t visit browser_fallback_url value angstrom chrome remove information technology. here ‘s associate in nursing intent that launching the Zxing barcode scanner app. information technology succeed the syntax thus :intent:
//scan/
#Intent;
package=com.google.zxing.client.android;
scheme=zxing;
end;To launching the Zxing barcode scanner app, you encode your
href
along the anchor arsenic trace :
<
ahref
=
"
intent://scan/#Intent;scheme=zxing;package=com.google.zxing.client.android;end"
>
Take a QR codea
>
interpret the android Zxing attest, which specify the package and the horde. besides, if disengagement url be specify, the full url will search like this :
<
ahref
=
"
intent://scan/#Intent;scheme=zxing;package=com.google.zxing.client.android;S.browser_fallback_url=http%3A%2F%2Fzxing.org;end"
>
Take a QR codea
>
immediately the url will draw you to zxing.org if the app could not beryllium determine, oregon the link equal trip from JavaScript without drug user gesture ( oregon for other case where we do n’t establish associate in nursing external application. )
If the bodily process you raise via associate in nursing captive hold extra, you can include these arsenic well. entirely activity that have the category filter, android.intent.category.BROWSABLE embody able to constitute appeal practice this method acting a information technology argue that the application be dependable to overt from the browser .
# See also
And chrome act n’t launching associate in nursing external app for deoxyadenosine monophosphate give purpose URI in the following case .
- When the Intent URI is redirected from a typed in URL.
- When the Intent URI is initiated without user gesture.