Java tutorial
//package com.java2s; import android.content.Context; import android.content.Intent; import android.net.Uri; public class Main { /** * Tries to open the app store by using the passed storeAppUri. If this * fails, opens the store website. * * @param ctx The Android context. * @param storeAppUri The app store uri. * @param storeWebsiteUri The store website. */ public static void openAppStore(Context ctx, Uri storeAppUri, Uri storeWebsiteUri) { Intent marketIntent; try { marketIntent = new Intent(Intent.ACTION_VIEW, storeAppUri); marketIntent.addFlags(Intent.FLAG_ACTIVITY_NO_HISTORY | Intent.FLAG_ACTIVITY_CLEAR_WHEN_TASK_RESET); ctx.startActivity(marketIntent); } catch (android.content.ActivityNotFoundException anfe) { marketIntent = new Intent(Intent.ACTION_VIEW, storeWebsiteUri); marketIntent.addFlags(Intent.FLAG_ACTIVITY_NO_HISTORY | Intent.FLAG_ACTIVITY_CLEAR_WHEN_TASK_RESET); ctx.startActivity(marketIntent); } } }