Thursday, 15 August 2013

detection - How to detect whether or not an Android phone has a specific app installed? -


I have previously used the meta tag described in this to detect the iPhone app:

Now I'm trying to do this to sniff the Droid-App. Actually, I want to know whether the user has a 'sniffing' app installed or not.

How can I find out if the smartphone has an Android app installed or not?

To change the code function, with "com.your.package.appname.id" application ID.

ID app packages and market URLs eg There is a Gmail App URL in the market and id / packagename is com.google.android.gm

  import android.app.Activity; Import android.content.pm.PackageManager; Importroid.os.Bundle; Public category example enhances activity {@ Override Protected Zero to Create (InstantState saved from bundle) {super.onCreate (savedInstanceState); SetContentView (R.layout.main); // Put the package name here ... Boolean installed = app installed ornot ("com.your.package.appname.id"); If (installed) {System.out.println ("the app has already installed your Android OS"); } Else {System.out.println ("The app is not installed on your Android"); }} Private Boolean application installed OrNot (string uri) {PackageManager pm = getPackageManager (); Boolean app_installed = false; Try {Pm.getPackageInfo (uri, PackageManager.GET_ACTIVITIES); App_installed = true; } Hold (PackageManager.NameNotFoundException e) {app_installed = false; } Back to app_installed; }}    

No comments:

Post a Comment