Check if an app already exists in Android market v

2019-04-12 12:47发布

问题:

This Android market API has a method isInMarket(). Can I use this method to check if an app already exists in the Android market?

AppInfo mAppInfo = new AppInfo("packagename.example");
if (!mAppInfo.isInMarket()) {
    //app non-exist in the android market
} 
else {
    //app exist in the android market
}

I tested this code in an emulator but it doesn't work. How can I make it work?

回答1:

The android emulator does not have the market app installed in it so the framework wont work. The web-android-market-api requires that you have the android market app installed.

Here is a link on how to install market onto the emulator