package com.convenient.android.common.utils

import android.content.Context
import android.content.pm.PackageManager


/**
 * @classname PackageUtil
 * @author LiuXiaoLong
 * @date 2022-07-19 PM
 * @description packageManager相关的工具类
 */
object PackageUtil {

    /**
     * @methodName：isInstallSoftware created by luozhipeng on 5/12/17 13:29.
     * @description: 判断设备是否装有某个应用
     */
    fun isInstallSoftware(context: Context, packageName: String): Boolean {
        val packageManager: PackageManager = context.packageManager
        val pInfo = packageManager.getPackageInfo(packageName, PackageManager.COMPONENT_ENABLED_STATE_DEFAULT)
        /****** 判断是否获取到了对应的包名信息  */
        return pInfo != null
    }
    
}