Skip to content

Instantly share code, notes, and snippets.

@dustedrob
dustedrob / build.gradle
Created June 9, 2017 15:37
Gradle dependency for Android Things
//this dependency is to provide android-things compatibility in your app's gradle file
provided 'com.google.android.things:androidthings:0.4-devpreview'
@dustedrob
dustedrob / AndroidManifest.xml
Created June 9, 2017 15:35
Android Things dependency in AndroidManifest.xml
<!--this line is for android-things compatibility-->
<uses-library android:name="com.google.android.things"/>
Bridgefy.start(new MessageListener() {
@Override
public void onMessageReceived(Message message) {
super.onMessageReceived(message);
//We have received a message from another peer
}
}, new StateListener() {
@Override
public void onDeviceConnected(Device device, Session session) {
super.onDeviceConnected(device, session);
@dustedrob
dustedrob / Android Things Check
Created June 6, 2017 18:15
Handy check that allows you to see if your device is running Android Things.
public boolean isThingsDevice(Context context) {
final PackageManager pm = context.getPackageManager();
return pm.hasSystemFeature("android.hardware.type.embedded");
}
UUID.fromString("0000" + longUuid.toString().substring(4, 8) + "-0000-1000-8000-00805f9b34fb");
<?xml version="1.0" encoding="utf-8"?>
<resources>
<color name="material_red50">#ffffebee</color>
<color name="material_red100">#ffffcdd2</color>
<color name="material_red200">#ffef9a9a</color>
<color name="material_red300">#ffe57373</color>
<color name="material_red400">#ffef5350</color>
<color name="material_red500">#fff44336</color>
<color name="material_red600">#ffe53935</color>
<color name="material_red700">#ffd32f2f</color>
@dustedrob
dustedrob / gist:21cd2f6e25082bca5918
Last active October 27, 2015 05:26
Solving the multidex limit on android apps
Steps to solve the dex limit error on android apps:
Make sure you have the v21 support library
compile "com.android.support:appcompat-v7:21.0.0"
Add the multidex support jar to your project libraries. This jar is located in your SDK folder on the following path:
extras/android/support/multidex/library/libs/android-support-multidex.jar