app/src/main/java/com/treslines/pagsegurodemo/AppUtil.java
public static void navigateToGooglePlayStore(final Activity activity, final String googlePlayStoreId, final int requestCode) {
        try {
            activity.startActivityForResult(new Intent(Intent.ACTION_VIEW, Uri.parse("market://details?id=" + googlePlayStoreId)), requestCode);
        } catch (android.content.ActivityNotFoundException anfe) {
            // last chance: try again a second time with a different approach
            activity.startActivityForResult(new Intent(Intent.ACTION_VIEW, Uri.parse("http://play.google.com/store/apps/details?id=" + googlePlayStoreId)), requestCode);
        }
    }
/**
     *  Use this method to open the google play store
     * @param activity the app which wants to redirect to the google play store
     * @param googlePlayStoreId the third part app's package name. something like: com.example.package
     * @param requestCode the request code to be used in the method onActivityForResult in the app which called this method.
     */
Use this method to open the google play store
@param activity the app which wants to redirect to the google play store
@param googlePlayStoreId the third part app's package name. something like: com.example.package
@param requestCode the request code to be used in the method onActivityForResult in the app which called this method.
Use this method to open the google play store @param activity the app which wants to redirect to the google play store @param googlePlayStoreId the third part app ' s package name . something like : com . example . package @param requestCode the request code to be used in the method onActivityForResult in the app which called this method .
public static void navigateToGooglePlayStore(final Activity activity, final String googlePlayStoreId, final int requestCode) {
        try {
            activity.startActivityForResult(new Intent(Intent.ACTION_VIEW, Uri.parse("market://details?id=" + googlePlayStoreId)), requestCode);
        } catch (android.content.ActivityNotFoundException anfe) {
            activity.startActivityForResult(new Intent(Intent.ACTION_VIEW, Uri.parse("http://play.google.com/store/apps/details?id=" + googlePlayStoreId)), requestCode);
        }
    }
public static void navigateToGooglePlayStore ( final Activity activity , final String googlePlayStoreId , final int requestCode ) { try { activity . startActivityForResult ( new Intent ( Intent . ACTION_VIEW , Uri . parse ( "market://details?id=" + googlePlayStoreId ) ) , requestCode ) ; } catch ( android . content . ActivityNotFoundException anfe ) { activity . startActivityForResult ( new Intent ( Intent . ACTION_VIEW , Uri . parse ( "http://play.google.com/store/apps/details?id=" + googlePlayStoreId ) ) , requestCode ) ; } }
Use this method to open the google play store
 @param activity the app which wants to redirect to the google play store
 @param googlePlayStoreId the third part app's package name.
Use this method to open the google play store @param activity the app which wants to redirect to the google play store @param googlePlayStoreId the third part app ' s package name .
// last chance: try again a second time with a different approach