本文整理汇总了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";
}
示例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;
}
示例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;
}
示例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;
}
示例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, "空!");
}
}
}