Created
May 21, 2014 09:19
-
-
Save yrom/9918a8d5244a2f8ced11 to your computer and use it in GitHub Desktop.
Android: Check for Available Features at Runtime
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Check if android.hardware.telephony feature is available. | |
if (getPackageManager().hasSystemFeature("android.hardware.telephony")) { | |
Log.d("Mobile Test", "Running on phone"); | |
// Check if android.hardware.touchscreen feature is available. | |
} else if (getPackageManager().hasSystemFeature("android.hardware.touchscreen")) { | |
Log.d("Tablet Test", "Running on devices that don't support telphony but have a touchscreen."); | |
} else { | |
Log.d("TV Test", "Running on a TV!"); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment