Created
June 7, 2017 21:52
-
-
Save jdkoren/0f5e5eca6a08b7c4cd7e73639e0920a2 to your computer and use it in GitHub Desktop.
I can haz IOT?
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
<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