Skip to content

Instantly share code, notes, and snippets.

@yakdere
Created April 1, 2015 00:48
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 yakdere/ed3d6b3f458cbe9ea313 to your computer and use it in GitHub Desktop.
Save yakdere/ed3d6b3f458cbe9ea313 to your computer and use it in GitHub Desktop.
Wearables
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