is Renren App Existed - Android App

Android examples for App:Popular App

Description

is Renren App Existed

Demo Code


//package com.java2s;
import java.util.List;
import android.content.Context;

import android.content.pm.PackageInfo;
import android.content.pm.PackageManager;

public class Main {

    public static final String PACKAGE_NAME_RENREN = "com.renren.mobile.android";

    public static boolean isRenrenExisted(Context context) {
        if (checkApp(context, PACKAGE_NAME_RENREN)) {
            return true;
        } else {/*from w  w  w .  j  a v  a  2s .  c om*/
            return false;
        }
    }

    private static boolean checkApp(Context context, String packageName) {
        PackageManager pm = context.getPackageManager();
        List<PackageInfo> packs = pm.getInstalledPackages(0);
        for (PackageInfo pi : packs) {
            if (pi.applicationInfo.packageName.equals(packageName)) {
                return true;
            }
        }
        return false;
    }
}

Related Tutorials