exist Browser App - Android App

Android examples for App:APK Information

Description

exist Browser App

Demo Code


//package com.java2s;
import android.content.ComponentName;
import android.content.Context;
import android.content.Intent;
import android.content.pm.PackageManager;

import android.net.Uri;

public class Main {
    public static boolean existBrowserApp(Context context) {
        Intent intent = new Intent(Intent.ACTION_VIEW);
        intent.addCategory(Intent.CATEGORY_BROWSABLE);
        intent.setData(Uri.parse("http://"));
        return verifyIntentReceiveApp(context, intent);
    }/* ww w. ja va2  s  . c  o m*/

    public static boolean verifyIntentReceiveApp(Context context,
            Intent intent) {
        PackageManager pm = context.getPackageManager();
        ComponentName componentName = intent.resolveActivity(pm);
        return componentName != null;
    }
}

Related Tutorials