Advertisement
Ankhwatcher

Wear send data

Oct 7th, 2014
247
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 1.10 KB | None | 0 0
  1. private void putData(List<ObjStationData> results) {
  2.         if (results != null && results.size() > 0) {
  3.             PutDataMapRequest putDataMapRequest = PutDataMapRequest.create(Constants.GET_NEAREST_DART);
  4.             DataMap dataMap = putDataMapRequest.getDataMap();
  5.  
  6.             StationDataResponse objStationDataListSerializable = new StationDataResponse();
  7.             objStationDataListSerializable.setObjStationDataList(results);
  8.             byte[] data = SerializationUtils.serialize(objStationDataListSerializable);
  9.             dataMap.putByteArray(Constants.STATION_DATA_LIST, data);
  10.             dataMap.putString(Constants.STATION_NAME, mClosestStationName);
  11.  
  12.  
  13.             Wearable.DataApi.putDataItem(mGoogleApiClient, putDataMapRequest.asPutDataRequest()).setResultCallback(new ResultCallback<DataApi.DataItemResult>() {
  14.                 @Override
  15.                 public void onResult(DataApi.DataItemResult dataItemResult) {
  16.  
  17.                 }
  18.             });
  19.         } else {
  20.             sendMessage(Constants.NO_DARTS_AVAILABLE, mClosestStationName);
  21.         }
  22.  
  23.         stopSelf();
  24.     }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement