Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

//package com.java2s;

import android.app.Activity;

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

public class Main {
    private static final String WX_PACKAGE_NAME = "com.tencent.mm";

    public static boolean hasInstalledWx(Activity activity) {
        try {
            PackageManager manager = activity.getPackageManager();
            PackageInfo info = manager.getPackageInfo(WX_PACKAGE_NAME, PackageManager.GET_ACTIVITIES);
            if (info != null) {
                return true;
            }
        } catch (Exception e) {
            e.printStackTrace();
        }
        return false;
    }
}