lundi 22 février 2016

Android QR check if app exist

I'm scanning QR code (where specific data is coded) with QR scanner. If my app is installed on the device, the app is launched. If the app doesn't installed then it takes the user the marketplace to download the app. I've searched a lot on internet and only found this question.

Here's activity from manifest file which is called when QR code is scanned

<activity android:name=".map.TestQrOpenActivity">
            <intent-filter>
                <action android:name="android.intent.action.VIEW"/>
                <category android:name="android.intent.category.DEFAULT"/>
                <category android:name="android.intent.category.BROWSABLE"/>
                <data android:scheme="uniqueapp"/>
            </intent-filter>
</activity>

and here's the string which is coded in my QR code

uniqueapp://myData

and that works perfectly if app installed in device, but if it's not installed I need to go to google play and download it basically if app exist open uniqueapp://myData else open market://details?id=com.my.package.name So is this possible? (I don't whant to write my own scanner)

Aucun commentaire:

Enregistrer un commentaire