Created
April 1, 2015 00:48
-
-
Save yakdere/ed3d6b3f458cbe9ea313 to your computer and use it in GitHub Desktop.
Wearables
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
public class ListenerService extends WearableListenerService { | |
private static final String WEARABLE_DATA_PATH = "/wearable_data"; | |
@Override | |
public void onDataChanged(DataEventBuffer dataEvents) { | |
for (DataEvent event : dataEvents) { | |
// Check the data type | |
if (event.getType() == DataEvent.TYPE_CHANGED) { | |
// Check the data path | |
String path = event.getDataItem().getUri().getPath(); | |
if (path.equals(WEARABLE_DATA_PATH)) {} | |
DataMap dataMap = DataMapItem.fromDataItem(event.getDataItem()).getDataMap(); | |
Asset asset = dataMap.getAsset(“asset_id”); | |
Bitmap bitmap = loadBitmapFromAsset(asset); | |
... | |
} | |
... | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment