[android] Programmatically check Play Store for app updates

private void CheckUPdate() {
    VersionChecker versionChecker = new VersionChecker();
    try
    {   String appVersionName = BuildConfig.VERSION_NAME;
        String mLatestVersionName = versionChecker.execute().get();
        if(!appVersionName.equals(mLatestVersionName)){
            AlertDialog.Builder alertDialog = new AlertDialog.Builder(Activity.this);
            alertDialog.setTitle("Please update your app");
            alertDialog.setMessage("This app version is no longer supported. Please update your app from the Play Store.");
            alertDialog.setPositiveButton("UPDATE NOW", new DialogInterface.OnClickListener() {
                public void onClick(DialogInterface dialog, int which) {
                    final String appPackageName = getPackageName();
                    try {
                        startActivity(new Intent(Intent.ACTION_VIEW, Uri.parse("market://details?id=" + appPackageName)));
                    } catch (android.content.ActivityNotFoundException anfe) {
                        startActivity(new Intent(Intent.ACTION_VIEW, Uri.parse("https://play.google.com/store/apps/details?id=" + appPackageName)));
                    }
                }
            });
            alertDialog.show();
        }

    } catch (InterruptedException | ExecutionException e) {
        e.printStackTrace();
    }
}

@SuppressLint("StaticFieldLeak")
public class VersionChecker extends AsyncTask<String, String, String> {
    private String newVersion;
    @Override
    protected String doInBackground(String... params) {

        try {
            newVersion = Jsoup.connect("https://play.google.com/store/apps/details?id="+getPackageName())
                    .timeout(30000)
                    .userAgent("Mozilla/5.0 (Windows; U; WindowsNT 5.1; en-US; rv1.8.1.6) Gecko/20070725 Firefox/2.0.0.6")
                    .referrer("http://www.google.com")
                    .get()
                    .select(".hAyfc .htlgb")
                    .get(7)
                    .ownText();
        } catch (IOException e) {
            e.printStackTrace();
        }
        return newVersion;
    }
}