open Morning Kit At Google Play - Android Intent

Android examples for Intent:App Market

Description

open Morning Kit At Google Play

Demo Code


//package com.java2s;
import android.app.Activity;
import android.content.ActivityNotFoundException;
import android.content.Context;
import android.content.Intent;
import android.net.Uri;
import android.widget.Toast;

public class Main {
    public static int REQ_REVIEW_APP = 4444;

    public static void openMorningKitAtGooglePlay(Context context) {
        Uri uri = Uri.parse(getMorningKitLink());
        openGooglePlay(context, uri);/*from   www. j a  v  a2s  .c  om*/
    }

    public static String getMorningKitLink() {
        return "market://details?id=your id";
    }

    private static void openGooglePlay(Context context, Uri uri) {
        Intent goToMarket = new Intent(Intent.ACTION_VIEW, uri);
        try {
            ((Activity) context).startActivityForResult(goToMarket,
                    REQ_REVIEW_APP);
        } catch (ActivityNotFoundException e) {
            Toast.makeText(context, "Couldn't launch the market",
                    Toast.LENGTH_SHORT).show();
        }
    }
}

Related Tutorials