user10949835
user10949835

Reputation:

How can i check that app is installed with my link or not or cancelled?

I want to to list some play store app links in my app. and i want that user click on the link and go to the play store and download the app. Now i want to track that if user clicked on the link and has he downloaded or not the app or not cancelled the download. so how can i implement this kind if feature in android studio.

Upvotes: 0

Views: 302

Answers (1)

Mahendra Gohil
Mahendra Gohil

Reputation: 390

using package manager you can check whether app installed or not

if(appInstalledOrNot(com.demo.package)){
    Toast.makeText(this,"App Installed",Toast.LENGTH_LONG).show();
} else {
    Toast.makeText(this,"App NOt Installed",Toast.LENGTH_LONG).show();
}
private boolean appInstalledOrNot(String packageName) {  
    PackageManager pm = this.getPackageManager();
    try {
        pm.getPackageInfo(packageName, PackageManager.GET_ACTIVITIES);
        return true;
    } catch (Exception e) {
        Log.e("::MG::",""+e);
        return false;
    } 
}
  • you can call this function onResume so when user come back to application from play-store you check application status is installed or not.

Upvotes: 1

Related Questions