当前位置: 首页>>代码示例>>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;未经允许,请勿转载。