Feature for getSystemAvailableFeatures() and hasSystemFeature(String).
The device supports host- based NFC card emulation.
Constant Value: "android.hardware.nfc.hce"
1. Get a PackageManager Instance named myPackageManager.
- Professional NFC Application Development for Android by Vedat Coskun
Constant Value: "android.hardware.nfc.hce"
1. Get a PackageManager Instance named myPackageManager.
2. Create a Boolean Variable named bolHCNFCSupported.
3. Set the Minimum and Target SDK version to 19 or greater.
4. In the onCreate method, add the below code. This will return the host-based NFC ability to a boolean named bolHCNFCSupported. It will then display a toast displaying the host-based NFC ability of the device to the user.
bolHCNFCSupported = myPackageManager.hasSystemFeature(PackageManager.FEATURE_NFC_HOST_CARD_EMULATION);
if (bolHCNFCSupported) {
Toast.makeText(this, "Device has host-based NFC capability", Toast.LENGTH_LONG).show();
} else {
Toast.makeText(this, "No host-based NFC capability!", Toast.LENGTH_LONG).show();
}
5. Compile and run!
Resources:
http://developer.android.com/reference/android/content/pm/PackageManager.html#FEATURE_NFC_HOST_CARD_EMULATION
Other Resources:
http://developer.android.com/reference/android/content/pm/PackageManager.html#FEATURE_NFC_HOST_CARD_EMULATION