How to check whether there are available features in Android

Quick questions:

Where can I find or check if there is a function (Bluetooth, NFC, WiFi, GPS, etc.) in the Android device?

Simpler example: if the device does not have Bluetooth available (i.e. no Bluetooth). Is there a way to check?

resolvent:

You can use packagemanager

The following code checks if a camera is available

import android.content.pm.PackageManager;

PackageManager pm = context.getPackageManager();

if (pm.hasSystemFeature(PackageManager.FEATURE_CAMERA)) {

}

http://developer.android.com/reference/android/content/pm/PackageManager.html

The content of this article comes from the network collection of netizens. It is used as a learning reference. The copyright belongs to the original author.
THE END
分享
二维码
< <上一篇
下一篇>>