hsz
hsz

Reputation: 152216

Figure out if Android application was installed via web Market or using Android Market app

Right now when user wants to download an application, he can do it using Android Market application installed on his phone or do it via web Market.

Is it possible to figure out, which way was this application installed ?

Upvotes: 2

Views: 223

Answers (2)

Mudassar
Mudassar

Reputation: 1576

Better it should be

else if ( installPM.equals("com.android.vending") ) {
        // Installed from the Android Market
        return true;
      }

Upvotes: 0

Force
Force

Reputation: 6382

Found this in the Android Cracking Blog:

private boolean InstalledFromMarketEasy() {

 String pname = this.getPackageName();
  PackageManager pm = this.getPackageManager();
  String installPM = pm.getInstallerPackageName(pname);

  if ( installPM == null ) {
    // Definitely not installed from Android Market
    return false;
  }
  else if ( installPM.equals("com.google.android.feedback") ) {
    // Installed from the Android Market
    return true;
  }

  return false;
}

According to the comments however, on some phones this does still return null.

Try this method to see if it returns null with your phone. If it doesn't, have a look if installPM changes when using Android Market Vending instead of the WebInterface.

If it doesn't change, I don't think it is possible to check how it was installed, as the Push-Notification is received by Vending.apk.

Upvotes: 6

Related Questions