The device has a telephony radio with data communication support.
Constant Value: "android.hardware.telephony"
1. Get a PackageManager Instance named myPackageManager.
2. Create a Boolean Variable named bolTelephonySupported.
3. Set the Minimum and Target SDK version to 7 or greater.
4. In the onCreate method, add the below code. This will return the telephony ability to a boolean named bolTelephonySupported. It will then display a toast displaying the telephony ability of the device to the user.
bolTelephonySupported = myPackageManager.hasSystemFeature(PackageManager.FEATURE_TELEPHONY);
if (bolTelephonySupported) {
Toast.makeText(this, "Device has Telephony capability", Toast.LENGTH_LONG).show();
} else {
Toast.makeText(this, "No Telephony capability!", Toast.LENGTH_LONG).show();
}
5. Compile and run!
Resources:
- Professional Android 4 Application Development by Reto Meier, pg 702
- Professional Android 4 Application Development by Reto Meier, pg 702