Skip to content

Instantly share code, notes, and snippets.

@jdkoren
Created June 7, 2017 21:52
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jdkoren/0f5e5eca6a08b7c4cd7e73639e0920a2 to your computer and use it in GitHub Desktop.
Save jdkoren/0f5e5eca6a08b7c4cd7e73639e0920a2 to your computer and use it in GitHub Desktop.
I can haz IOT?
<uses-library android:name="com.google.android.things" android:required="false" />
if (Utils.IS_IOT) {
// running Android Things
}
public class Utils {
public static final boolean IS_IOT = isIot();
private static boolean isIot() {
try {
new PeripheralManagerService();
return true;
} catch (NoClassDefFoundError e) {
// (╯°□°)╯︵ ┻━┻
}
return false;
}
private Utils() {
//no instance
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment