當前位置: 首頁>>代碼示例>>Java>>正文


Java PackageManager.getSystemAvailableFeatures方法代碼示例

本文整理匯總了Java中android.content.pm.PackageManager.getSystemAvailableFeatures方法的典型用法代碼示例。如果您正苦於以下問題:Java PackageManager.getSystemAvailableFeatures方法的具體用法?Java PackageManager.getSystemAvailableFeatures怎麽用?Java PackageManager.getSystemAvailableFeatures使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在android.content.pm.PackageManager的用法示例。


在下文中一共展示了PackageManager.getSystemAvailableFeatures方法的5個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: getOpenGL

import android.content.pm.PackageManager; //導入方法依賴的package包/類
/**
 * Returns the current device openGL version.
 */
static String getOpenGL(Context context) {
    PackageManager packageManager = context.getPackageManager();
    FeatureInfo[] featureInfos = packageManager.getSystemAvailableFeatures();
    if (featureInfos != null && featureInfos.length > 0) {
        for (FeatureInfo featureInfo : featureInfos) {
            // Null feature name means this feature is the open gl es version feature.
            if (featureInfo.name == null) {
                if (featureInfo.reqGlEsVersion != FeatureInfo.GL_ES_VERSION_UNDEFINED) {
                    return Integer.toString((featureInfo.reqGlEsVersion & 0xffff0000) >> 16);
                } else {
                    return "1"; // Lack of property means OpenGL ES version 1
                }
            }
        }
    }
    return "1";
}
 
開發者ID:weiwenqiang,項目名稱:GitHub,代碼行數:21,代碼來源:CrashDetails.java

示例2: isSupportCameraLedFlash

import android.content.pm.PackageManager; //導入方法依賴的package包/類
/**
 * 判斷是否支持閃光燈
 *
 * @return true 支持,false 不支持
 */
public static boolean isSupportCameraLedFlash() {
    PackageManager pm = UtilManager.getContext().getPackageManager();
    if (pm != null) {
        FeatureInfo[] features = pm.getSystemAvailableFeatures();
        if (features != null) {
            for (FeatureInfo f : features) {
                //判斷設備是否支持閃光燈
                if (f != null && PackageManager.FEATURE_CAMERA_FLASH.equals(f.name)) {
                    return true;
                }
            }
        }
    }
    return false;
}
 
開發者ID:sundevin,項目名稱:utilsLibrary,代碼行數:21,代碼來源:DeviceInfo.java

示例3: isSupportCameraLedFlash

import android.content.pm.PackageManager; //導入方法依賴的package包/類
/** 判斷是否支持閃光燈 */
public static boolean isSupportCameraLedFlash(PackageManager pm) {
    if (pm != null) {
        FeatureInfo[] features = pm.getSystemAvailableFeatures();
        if (features != null) {
            for (FeatureInfo f : features) {
                if (f != null && PackageManager.FEATURE_CAMERA_FLASH.equals(f.name)) //判斷設備是否支持閃光燈
                    return true;
            }
        }
    }
    return false;
}
 
開發者ID:Zhaoss,項目名稱:WeiXinRecordedDemo,代碼行數:14,代碼來源:DeviceUtils.java

示例4: isSupportCameraLedFlash

import android.content.pm.PackageManager; //導入方法依賴的package包/類
public static boolean isSupportCameraLedFlash(PackageManager pm) {
    if (pm != null) {
        FeatureInfo[] features = pm.getSystemAvailableFeatures();
        if (features != null) {
            for (FeatureInfo f : features) {
                if (f != null && PackageManager.FEATURE_CAMERA_FLASH.equals(f.name))
                    return true;
            }
        }
    }
    return false;
}
 
開發者ID:JunGeges,項目名稱:AliZhiBoHao,代碼行數:13,代碼來源:CommonUtils.java

示例5: initView

import android.content.pm.PackageManager; //導入方法依賴的package包/類
@Override
protected void initView() {
    ShortCutUtil.addShortcut(getApplicationContext());

    new RevealEffectUtil().createEnterRevealEffect(this);

    mToolbar.setLogo(R.drawable.vector_user_default_logo);
    mToolbar.setTitleMarginStart(30);
    setToolbarTitle(getString(R.string.nav_home_page));

    mDrawerLayout = findView(R.id.drawer_layout);

    mToggle = new ActionBarDrawerToggle(this, mDrawerLayout, mToolbar, 0, 0);

    NavigationView navigationView = findView(R.id.navigation_view);
    navigationView.setNavigationItemSelectedListener(this);
    ImageView userLogo = (ImageView) navigationView.findViewById(R.id.nav_user_logo);


    mToggle.syncState();
    mDrawerLayout.addDrawerListener(mToggle);

    PackageManager pm = getPackageManager();

    FeatureInfo[] features = pm.getSystemAvailableFeatures(); //得到所有支援的硬件種類
    Log.d(TAG, "initView: feature:size:" + (features == null));
    for (FeatureInfo feature : features) {
        if (feature != null) {
            String name = feature.name;
            if (TextUtils.isEmpty(name)) {
                Log.v(TAG, "name2: " + feature.reqGlEsVersion);
            } else {
                Log.v(TAG, "name1: " + feature.name);
            }
        } else {
            Log.d(TAG, "空!");
        }
    }

}
 
開發者ID:fendoudebb,項目名稱:PlayAndroid,代碼行數:41,代碼來源:MainActivity.java


注:本文中的android.content.pm.PackageManager.getSystemAvailableFeatures方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。