android – Launch App or Play Store by scanning QR code
android – Launch App or Play Store by scanning QR code
You could create a URL which would be recognized by your app, and would open it automatically (you can declare these in your manifest).
You could make that page display something like Redirecting you to Google Play…, and then redirect in a few seconds.
So if they have the app installed, the URL would trigger opening it, if it is not opened, it would stay in the browser and redirect to Google Play.
This is the solution Ive found for the same issue:
1. Ive created a simple http landing-page with 2 badges, the 1st for Google-play android app and the 2nd for the Apple App Store app. (https://www.example.com/landingPage)
2. Ive added the following lines in the manifest (as well described above):
<data android_scheme=https android_host=www.example.com android_pathPrefix=/landingPage /> </intent-filter>
- Ive generated a QrCode from the URL https://www.example.com/landingPage. You can eventually add some parameters at the end to handle in the App in the future (https://www.example.com/landingPage¶m1=value1 ecc.).
So, when you catch the QrCode for the first time, you are directed through the browser to the landing page and can choose the app to download and install. The coming times you catch the QrCode the device show you the app list to use to execute it and you will find there the app just installed.
This works fine for me
android – Launch App or Play Store by scanning QR code
you can through a html page
please note Android_URL like [scheme]://[host]/[path]?[query]
scheme:which App you want to start
host:note
path:key
query:Key and value
Android_URL = myapp://www.test.com/openwith?uid=123;
<html>
<head>
<meta http-equiv=Content-Type content=text/html; charset=UTF-8 />
<meta content=telephone=no name=format-detection />
<meta name=viewport content=width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0 />
<title>open or download App</title>
<script src=assets/plugins/jquery-1.8.3.min.js type=text/javascript></script>
</head>
<body>
<a id=vlink onClick=try_to_open_app() style=display:none></a>
<script>
var browser={
versions:function(){
var u = navigator.userAgent, app = navigator.appVersion;
};
}()
}
var Android_URL = myapp://www.test.com/openwith?uid=123;
function open_link() {
window.location=mtUrl;
}
function try_to_open_app() {
setTimeout(open_link(), 500);
}
//Android
else if(browser.versions.android){
document.getElementById(vlink).setAttribute(href,Android_URL);
document.getElementById(vlink).click();
}
else{
open_link();
}
</script>
</body>
</html>
**android**
<activity
android_name=net.laobanquan.im.splash.StartActivity
android_launchMode=singleTop
android_screenOrientation=portrait
android_theme=@android:style/Theme.Black.NoTitleBar >
<intent-filter>
<action android_name=android.intent.action.MAIN />
<category android_name=android.intent.category.LAUNCHER />
</intent-filter>
</activity>
<!-- new in -->
<activity
android_name=net.test.WebStartActivity
android_screenOrientation=portrait>
<intent-filter>
<action android_name=android.intent.action.VIEW></action>
<category android_name=android.intent.category.DEFAULT></category>
<category android_name=android.intent.category.BROWSABLE></category>
<data android_scheme=myapp android_host=www.test.com android_path=/openwith/>
</intent-filter>
</activity>
**activity**
String action = getIntent().getAction();
String uid = null;
if(Intent.ACTION_VIEW.equals(action)){
Uri uri = getIntent().getData();
if(uri != null){
uid = uri.getQueryParameter(uid);
}
}
Log.d(TAG, uid);