user2431597
user2431597

Reputation: 29

Check if on device has a certain application

In my application i need to check if on my devices is present "Amazon Appstore". How can I do this? Guide Me. I have no idea. Thanks.

Upvotes: 0

Views: 77

Answers (3)

newBie
newBie

Reputation: 118

Just get the package name and use package manager to get all the apps instead and check one by one with the package name you have. You can get package name from the google play link of the app you need.

Upvotes: 1

Devu Soman
Devu Soman

Reputation: 2266

Try this

private boolean isAppInstalled(String packageName) {
        PackageManager packageManager = getPackageManager();
        boolean installed = false;
        try {
            packageManager.getPackageInfo(packageName, PackageManager.GET_ACTIVITIES);
            installed = true;
        } catch (PackageManager.NameNotFoundException e) {
            installed = false;
        }
        return installed;
    }

Upvotes: 1

Related Questions