I'm looking for a way to find out if a specific application is installed from a client-side web browser. The platform is Android.
For example I write my own web site and I write my own application, now I want to when user comes to my own site from Android phone Browser. The Browser look if the application is already installed on the phone and if not suggest to install application. Can I do that ?
But you can do a trick to open the app if it's installed or open its Google Play page if it isn't. Explaining: when the user navigates to http://www.myurl.com/openmyapp, if the app is installed, an intent will be created and the Activity will be shown.
Your website can check if your Android app is installed.
On your Android phone, open the Google Play store app and tap the menu button (three lines). In the menu, tap My apps & games to see a list of apps currently installed on your device. Tap All to see a list of all apps you've downloaded on any device using your Google account.
There is a way to achieve this.
You cannot detect if a particular application is installed, for security and privacy reasons. But you can do a trick to open the app if it's installed or open its Google Play page if it isn't.
To do that, you must create an intent-filter on your app's main activity, to open it when a given URL is called. Like this:
<activity android:name=".MainActivity > <intent-filter> <data android:host="www.myurl.com" android:pathPrefix="/openmyapp" android:scheme="http" > </data> <action android:name="android.intent.action.VIEW" /> <category android:name="android.intent.category.DEFAULT" /> <category android:name="android.intent.category.BROWSABLE" /> <category android:name="android.intent.category.LAUNCHER" /> </intent-filter> </activity>
Explaining: when the user navigates to http://www.myurl.com/openmyapp, if the app is installed, an intent will be created and the Activity will be shown.
But what if the user doesn't have the app installed? Then you need to create a redirect page on your http://www.myurl.com/openmyapp/index.html. When the user reaches this address, your server must redirect to market://details?id=com.your.app.package
.
This way, when no Intent is created after the user navigates to http://www.myurl.com/openmyapp, the webserver will call another URL. That URL, in turn, will open Google Play on the device, directly on the app's page.
Hope it helps.
You mean from JavaScript running in the browser? I think (hope) that's impossible. I wouldn't want any random website to be able to see what apps are installed.
If you want the user to install a particular app, you can provide a Market link on your website: http://developer.android.com/guide/publishing/publishing.html#marketintent
Edit: After your clarification in the comments to my answer, a more useful answer appeared below, which rightfully has more upvotes.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With