Show App On Market Place - Android android.content.pm

Android examples for android.content.pm:App

Description

Show App On Market Place

Demo Code

import android.app.Activity;
import android.content.Intent;
import android.net.Uri;
import android.widget.Toast;

public class Main {

  public static void ShowAppOnMarketPlace(Activity currentActivity, int urlId) {
    try {/*from  ww  w.ja v a2s  .c  o  m*/
      ShowWebPage(currentActivity, currentActivity.getString(urlId));
    } catch (Exception e) {
      Toast.makeText(currentActivity, "Play Store Unavailable", Toast.LENGTH_LONG).show();
    }
  }

  public static void ShowWebPage(Activity currentActivity, String url) {
    Intent intent = new Intent();
    intent.setAction(Intent.ACTION_VIEW);
    intent.addCategory(Intent.CATEGORY_BROWSABLE);
    intent.setData(Uri.parse(url));
    currentActivity.startActivity(intent);
  }

}

Related Tutorials