本文整理匯總了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, "空!");
}
}
}