Detect application installed or not?

I have an application that registers a handler for a custom URI on the phone. I can launch the application by making a link to "myapp: // act / launch" from the phoneโ€™s web pages. This only works if my application is installed on the device. What I want to do is to determine if the URI scheme from the browser is supported, and then request my own message โ€œdownload the application, etc.โ€ if a handler for the URI scheme is not found.

Is there a way to find or find a list of URL scheme handlers on the phone in a web browser?

+22
android
Oct 13 '10 at 10:15
source share
2 answers

From instructions for Android

If you ever need to know if a particular application is installed on a user device, you can use the PackageManager. From the Context class (e.g. Activity or Service) you can call getPackageManager (). This gives you many methods, one of which is getPackageInfo (). Below is a method you can use. You can call it like this:

isAppInstalled("com.simexusa.campusmaps_full"); private boolean isAppInstalled(String packageName) { PackageManager pm = getPackageManager(); boolean installed = false; try { pm.getPackageInfo(packageName, PackageManager.GET_ACTIVITIES); installed = true; } catch (PackageManager.NameNotFoundException e) { installed = false; } return installed; } 
+61
Feb 16 2018-11-12T00:
source share
  • You need to create a web page that the user will land on if the application is not installed. Say http://www.yourcompany.com/android/android_app_is_not_installed_landing_page.html

  • The application must register in the manifest of the XML file www.yourcompany.com, the scheme "http" and the path parameter to the application do not set the landing page in the filter of the intentional manifest:

     <!-- These intents are used to launch the app from the web page--> <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="http" android:host="www.yourcompany.com" android:path="/android/android_app_is_not_installed_landing_page.html" /> </intent-filter> 
  • Now on the web page that invokes your application, you provide a full link to android_app_is_not_installed_landing_page.html, followed by the parameters that you want to pass to the application:

http://www.yourcompany.com/android/ android_app_is_not_installed_landing_page.html? '> Click here to start the application, if installed

If the application is installed, will it be launched and transferred completely http://www.yourcompany.com/android/android_app_is_not_installed_landing_page.html ? 'in the sense that he needs to disassemble, extract and do whatever he has to do.

If the application is not installed, the Android web browser opens. The installed landing page "Android application is not installed" http://www.yourcompany.com/android/android_app_is_not_installed_landing_page.html o, This page should inform the user about the installation of the application and provide in order to install it from the Android market.

found it here: https://groups.google.com/forum/m/?fromgroups#!topic/android-developers/RGLHkGUpRoA

+14
Mar 06 '13 at 3:45
source share



All Articles