Advertisement
Ankhwatcher

Wear receive data

Oct 7th, 2014
250
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.78 KB | None | 0 0
  1.  @Override
  2.     public void onDataChanged(DataEventBuffer dataEvents) {
  3.         if (BuildConfig.DEBUG)
  4.             Log.d(Constants.LOGTAG, "Data Changed: " + dataEvents.getCount());
  5.  
  6.         NotificationManager notificationManagerCompat = ((NotificationManager) getSystemService(NOTIFICATION_SERVICE));
  7.         for (DataEvent dataEvent : dataEvents) {
  8.             if (dataEvent.getType() == DataEvent.TYPE_CHANGED) {
  9.                 LocalBroadcastManager.getInstance(this).sendBroadcast(new Intent(WearConstants.ACTION_TRAIN_INFORMATION_RECEIVED));
  10.                 DataMap dataMap = DataMap.fromByteArray(dataEvent.getDataItem().getData());
  11.                 StationDataResponse objStationDataListSerializable = SerializationUtils.deserialize((byte[]) dataMap.get(Constants.STATION_DATA_LIST));
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement