Created
September 21, 2015 12:19
-
-
Save eygraber/58ad0879c608f537beaa to your computer and use it in GitHub Desktop.
Wear Assets
This file contains hidden or 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
PutDataMapRequest putDataMapReq = PutDataMapRequest.create(PATH); | |
DataMap dataMap = putDataMapReq.getDataMap(); | |
// I checked and the Asset gets created correctly | |
Asset asset = Asset.createFromUri(Uri.parse(uri)); | |
dataMap.putAsset(<some_key>, asset); | |
PutDataRequest putDataReq = putDataMapReq.asPutDataRequest(); | |
Wearable.DataApi.putDataItem(apiClient, putDataReq).setResultCallback(new ResultCallback<DataApi.DataItemResult>() { | |
@Override | |
public void onResult(DataApi.DataItemResult dataItemResult) { | |
Status status = dataItemResult.getStatus(); | |
if (!status.isSuccess()) { | |
// checks status and it is ASSET_UNAVAILABLE code 4005 | |
} | |
} | |
}, Wear.WRITE_TIMEOUT_SECONDS, TimeUnit.SECONDS); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment