Java Code Examples for com.google.android.gms.wearable.DataMap#putLong()

The following examples show how to use com.google.android.gms.wearable.DataMap#putLong() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: WearableService.java    From sms-ticket with Apache License 2.0 6 votes vote down vote up
private void sendSmsNotification(Ticket t, int status) {
    DebugLog.d("Send ticket to wear" + t.toString());
    final DataMap dataMap = new DataMap();
    dataMap.putLong("id", t.getId());
    dataMap.putLong("city_id", t.getCityId());
    dataMap.putString("city", t.getCity());
    dataMap.putInt("status", status);
    dataMap.putString("hash", t.getHash());
    dataMap.putString("text", t.getText());
    dataMap.putLong("valid_from", t.getValidFrom().toMillis(true));
    dataMap.putLong("valid_to", t.getValidTo().toMillis(true));
    dataMap.putLong("notification_id", t.getNotificationId());

    PutDataMapRequest data = PutDataMapRequest.createWithAutoAppendedId("/notification");
    data.getDataMap().putDataMap("notification", dataMap);
    syncDataItem(data);
}
 
Example 2
Source File: RawDisplayDataBgEntriesTest.java    From AndroidAPS with GNU Affero General Public License v3.0 6 votes vote down vote up
private DataMap dataMapForEntries() {

        DataMap dataMap = new DataMap();
        ArrayList<DataMap> entries = new ArrayList<>();
        for (int i=0; i<12; i++) {
            DataMap entry = new DataMap();
            entry.putLong("timestamp", WearUtilMocker.REF_NOW - Constants.MINUTE_IN_MS*4*(16-i));
            entry.putDouble("sgvDouble", 145.0-5*i);
            entry.putDouble("high", 170.0);
            entry.putDouble("low", 80.0);
            entry.putInt("color", 0);
            entries.add(entry);
        }
        dataMap.putDataMapArrayList("entries", entries);

        return dataMap;
    }
 
Example 3
Source File: WatchUpdaterService.java    From xDrip with GNU General Public License v3.0 6 votes vote down vote up
private void sendActiveBtDeviceData() {//KS
    if (is_using_bt) {//only required for Collector running on watch
        forceGoogleApiConnect();
        ActiveBluetoothDevice btDevice = ActiveBluetoothDevice.first();
        if (btDevice != null) {
            if (wear_integration) {
                DataMap dataMap = new DataMap();
                Log.d(TAG, "sendActiveBtDeviceData name=" + btDevice.name + " address=" + btDevice.address + " connected=" + btDevice.connected);

                dataMap.putLong("time", new Date().getTime()); // MOST IMPORTANT LINE FOR TIMESTAMP

                dataMap.putString("name", btDevice.name);
                dataMap.putString("address", btDevice.address);
                dataMap.putBoolean("connected", btDevice.connected);

                new SendToDataLayerThread(WEARABLE_ACTIVEBTDEVICE_DATA_PATH, googleApiClient).executeOnExecutor(xdrip.executor, dataMap);
            }
        }
    } else {
        Log.d(TAG, "Not sending activebluetoothdevice data as we are not using bt");
    }
}
 
Example 4
Source File: RawDisplayDataStatusTest.java    From AndroidAPS with GNU Affero General Public License v3.0 6 votes vote down vote up
private DataMap dataMapForStatus() {
    DataMap dataMap = new DataMap();
    dataMap.putString("currentBasal", "120%");
    dataMap.putString("battery", "76");
    dataMap.putString("rigBattery", "40%");
    dataMap.putBoolean("detailedIob", true);
    dataMap.putString("iobSum", "12.5") ;
    dataMap.putString("iobDetail","(11,2|1,3)");
    dataMap.putString("cob","5(10)g");
    dataMap.putString("bgi", "13");
    dataMap.putBoolean("showBgi", false);
    dataMap.putString("externalStatusString", "");
    dataMap.putInt("batteryLevel", 1);
    dataMap.putLong("openApsStatus", WearUtilMocker.REF_NOW - Constants.MINUTE_IN_MS*2);
    return dataMap;
}
 
Example 5
Source File: WatchUpdaterService.java    From xDrip-plus with GNU General Public License v3.0 6 votes vote down vote up
private void sendAlertTypeData() {//KS
    try {
        forceGoogleApiConnect();
        List<AlertType> alerts = AlertType.getAllActive();
        if (alerts != null) {
            if (wear_integration) {
                Log.d(TAG, "sendAlertTypeData latest count = " + alerts.size());
                final DataMap entries = new DataMap();
                final ArrayList<DataMap> dataMaps = new ArrayList<>(alerts.size());
                for (AlertType alert : alerts) {
                    if (alert != null) {
                        dataMaps.add(dataMap(alert, "alert"));
                    }
                }
                entries.putLong("time", new Date().getTime()); // MOST IMPORTANT LINE FOR TIMESTAMP
                entries.putDataMapArrayList("entries", dataMaps);
                new SendToDataLayerThread(WEARABLE_ALERTTYPE_DATA_PATH, googleApiClient).executeOnExecutor(xdrip.executor, entries);
            } else
                Log.d(TAG, "sendAlertTypeData latest count = 0");
        }
    } catch (NullPointerException e) {
        Log.e(TAG, "Nullpointer exception in sendAlertTypeData: " + e);
    }
}
 
Example 6
Source File: WatchUpdaterService.java    From xDrip-plus with GNU General Public License v3.0 6 votes vote down vote up
public static boolean sendWearTreatmentsDataDelete(List<String> list) {
    if (googleApiClient != null && !googleApiClient.isConnected() && !googleApiClient.isConnecting()) {
        googleApiClient.connect();
    }
    if (googleApiClient != null) {
        if (!list.isEmpty()) {
            Log.d(TAG, "sendWearTreatmentsDataDelete graph size=" + list.size());
            DataMap entries = new DataMap();
            entries.putLong("time", new Date().getTime()); // MOST IMPORTANT LINE FOR TIMESTAMP
            entries.putString("action", "delete");
            entries.putStringArrayList("entries", (new ArrayList<String>(list)));
            new SendToDataLayerThread(WEARABLE_TREATMENTS_DATA_PATH, googleApiClient).executeOnExecutor(xdrip.executor, entries);
        } else
            Log.d(TAG, "sendWearTreatmentsDataDelete treatments count = 0");
    } else {
        Log.e(TAG, "sendWearTreatmentsData No connection to wearable available for send treatment!");
        return false;
    }
    return true;
}
 
Example 7
Source File: ListenerService.java    From xDrip-plus with GNU General Public License v3.0 5 votes vote down vote up
private void sendPrefSettings() {//KS

        Log.d(TAG, "sendPrefSettings enter");
        forceGoogleApiConnect();
        DataMap dataMap = new DataMap();
        boolean enable_wearG5 = mPrefs.getBoolean("enable_wearG5", false);
        boolean force_wearG5 = mPrefs.getBoolean("force_wearG5", false);
        String node_wearG5 = mPrefs.getString("node_wearG5", "");
        String dex_txid = mPrefs.getString("dex_txid", "ABCDEF");
        boolean show_wear_treatments = mPrefs.getBoolean("show_wear_treatments", false);

        if (localnode == null || (localnode != null && localnode.isEmpty())) setLocalNodeName();
        Log.d(TAG, "sendPrefSettings enable_wearG5: " + enable_wearG5 + " force_wearG5:" + force_wearG5 + " node_wearG5:" + node_wearG5 + " localnode:" + localnode + " dex_txid:" + dex_txid + " show_wear_treatments:" + show_wear_treatments);
        dataMap.putLong("time", new Date().getTime()); // MOST IMPORTANT LINE FOR TIMESTAMP
        dataMap.putBoolean("enable_wearG5", enable_wearG5);
        dataMap.putBoolean("force_wearG5", force_wearG5);
        if (force_wearG5) {
            dataMap.putString("node_wearG5", localnode);
        } else {
            if (node_wearG5.equals(localnode)) {
                dataMap.putString("node_wearG5", "");
            } else {
                dataMap.putString("node_wearG5", node_wearG5);
            }
        }
        dataMap.putString("dex_txid", dex_txid);
        dataMap.putInt("bridge_battery", mPrefs.getInt("bridge_battery", -1));//Used in DexCollectionService
        dataMap.putInt("nfc_sensor_age", mPrefs.getInt("nfc_sensor_age", -1));//Used in DexCollectionService for LimiTTer
        dataMap.putBoolean("bg_notifications_watch", mPrefs.getBoolean("bg_notifications", false));
        dataMap.putBoolean("persistent_high_alert_enabled_watch", mPrefs.getBoolean("persistent_high_alert_enabled", false));
        dataMap.putBoolean("show_wear_treatments", show_wear_treatments);
        sendData(WEARABLE_PREF_DATA_PATH, dataMap.toByteArray());

        SharedPreferences.Editor prefs = PreferenceManager.getDefaultSharedPreferences(this).edit();
        if (!node_wearG5.equals(dataMap.getString("node_wearG5", ""))) {
            Log.d(TAG, "sendPrefSettings save to SharedPreferences - node_wearG5:" + dataMap.getString("node_wearG5", ""));
            prefs.putString("node_wearG5", dataMap.getString("node_wearG5", ""));
            prefs.apply();
        }
    }
 
Example 8
Source File: WatchUpdaterService.java    From AndroidAPS with GNU Affero General Public License v3.0 5 votes vote down vote up
private DataMap treatmentMap(long date, double bolus, double carbs, boolean isSMB, boolean isValid) {
    DataMap dm = new DataMap();
    dm.putLong("date", date);
    dm.putDouble("bolus", bolus);
    dm.putDouble("carbs", carbs);
    dm.putBoolean("isSMB", isSMB);
    dm.putBoolean("isValid", isValid);
    return dm;
}
 
Example 9
Source File: ListenerService.java    From xDrip-plus with GNU General Public License v3.0 5 votes vote down vote up
private synchronized DataMap getWearBgReadingData(int count, long last_send_time, int min_count) {
    forceGoogleApiConnect();

    Log.d(TAG, "getWearBgReadingData last_send_time:" + JoH.dateTimeText(last_send_time));

    BgReading last_bg = BgReading.last();
    if (last_bg != null) {
        Log.d(TAG, "getWearBgReadingData last_bg.timestamp:" + JoH.dateTimeText(last_bg.timestamp));
    }

    if (last_bg != null && last_send_time <= last_bg.timestamp) {//startTime
        long last_send_success = last_send_time;
        Log.d(TAG, "getWearBgData last_send_time < last_bg.timestamp:" + JoH.dateTimeText(last_bg.timestamp));
        final List<BgReading> graph_bgs = BgReading.latestForGraphAsc(count, last_send_time);
        if (!graph_bgs.isEmpty() && graph_bgs.size() > min_count) {
            //Log.d(TAG, "getWearBgData count = " + graph_bgs.size());
            final DataMap entries = dataMap(last_bg);
            final ArrayList<DataMap> dataMaps = new ArrayList<>(graph_bgs.size());
            for (BgReading bg : graph_bgs) {
                dataMaps.add(dataMap(bg));
                last_send_success = bg.timestamp;
                //Log.d(TAG, "getWearBgData bg getId:" + bg.getId() + " raw_data:" + bg.raw_data + " filtered_data:" + bg.filtered_data + " timestamp:" + bg.timestamp + " uuid:" + bg.uuid);
            }
            entries.putLong("time", new Date().getTime()); // MOST IMPORTANT LINE FOR TIMESTAMP
            entries.putDataMapArrayList("entries", dataMaps);
            Log.i(TAG, "getWearBgReadingData SYNCED BGs up to " + JoH.dateTimeText(last_send_success) + " count = " + graph_bgs.size());
            return entries;
        } else
            Log.i(TAG, "getWearBgReading SYNCED BGs up to " + JoH.dateTimeText(last_send_success) + " count = 0");
    }
    return null;
}
 
Example 10
Source File: RequestListenerService.java    From arcgis-runtime-demos-android with Apache License 2.0 5 votes vote down vote up
/**
 * Handles issuing a response to a FeatureType request. A FeatureType request
 * indicates that the Wear devices wants a list of available FeatureTypes for
 * the selected layer to display to the user.
 *
 * @param event the MessageEvent from the Wear device
 * @param client the Google API client used to communicate
 */
private void handleFeatureTypeRequest(MessageEvent event, GoogleApiClient client) {
  // Get the name and URL of the layer that was selected
  String layerName = new String(event.getData());
  String url = sLayerMap.get(layerName);
  // Create an ArcGISFeatureLayer with the specified URL
  sArcGISFeatureLayer = new ArcGISFeatureLayer(url, ArcGISFeatureLayer.MODE.SNAPSHOT);

  // While this isn't good practice, there is no way to be notified that an
  // ArcGISFeatureLayer has loaded its LayerServiceInfo. The OnStatusChangedListener
  // seems to be more relevant when the layer is actually being added to a MapView.
  // As such, we simply do a quick sleep until the LayerServiceInfo has been loaded
  try {
    while (sArcGISFeatureLayer.getLayerServiceInfo() == null) {
      Thread.sleep(500);
    }
  } catch (Exception e) {
    //
  }
  // Create a PutDataMapRequest with the FeatureType response path
  PutDataMapRequest req = PutDataMapRequest.create(FEATURE_TYPE_RESPONSE);
  DataMap dm = req.getDataMap();
  // Put an array list of the FeatureType names into the data map
  dm.putStringArrayList("featureTypes", FeatureLayerUtil.getFeatureTypes(sArcGISFeatureLayer));
  // Put the current time into the data map, which forces an onDataChanged event (this event
  // only occurs when data actually changes, so putting the time ensures something always changes)
  dm.putLong("Time", System.currentTimeMillis());
  // Put the DataItem into the Data API stream
  Wearable.DataApi.putDataItem(client, req.asPutDataRequest());
}
 
Example 11
Source File: DexCollectionService.java    From xDrip with GNU General Public License v3.0 5 votes vote down vote up
public static DataMap getWatchStatus() {
    DataMap dataMap = new DataMap();
    dataMap.putString("lastState", lastState);
    if (last_transmitter_Data != null)
        dataMap.putLong("timestamp", last_transmitter_Data.timestamp);
    dataMap.putInt("mStaticState", mStaticState);
    dataMap.putInt("last_battery_level", last_battery_level);
    dataMap.putLong("retry_time", retry_time);
    dataMap.putLong("failover_time", failover_time);
    dataMap.putString("static_last_hexdump", static_last_hexdump);
    dataMap.putString("static_last_sent_hexdump", static_last_sent_hexdump);
    return dataMap;
}
 
Example 12
Source File: ListenerService.java    From xDrip with GNU General Public License v3.0 5 votes vote down vote up
private synchronized void sendPersistentStore() {
    if (DexCollectionType.getDexCollectionType().equals(DexCollectionType.DexcomG5)) {
        DataMap dataMap = new DataMap();
        String dex_txid = mPrefs.getString("dex_txid", "ABCDEF");
        dataMap.putByteArray(G5_BATTERY_MARKER, PersistentStore.getBytes(G5_BATTERY_MARKER + dex_txid));
        dataMap.putLong(G5_BATTERY_FROM_MARKER, PersistentStore.getLong(G5_BATTERY_FROM_MARKER + dex_txid));
        dataMap.putString("dex_txid", dex_txid);

        dataMap.putByteArray(G5_FIRMWARE_MARKER, PersistentStore.getBytes(G5_FIRMWARE_MARKER + dex_txid));
        dataMap.putString("dex_txid", dex_txid);
        sendData(WEARABLE_G5BATTERY_PAYLOAD, dataMap.toByteArray());
    }
}
 
Example 13
Source File: ListenerService.java    From xDrip with GNU General Public License v3.0 5 votes vote down vote up
private synchronized void sendReplyMsg (String msg, long last_timestamp, String path, boolean showToast, int length) {
    Log.d(TAG, "sendReplyMsg msg=" + msg);
    DataMap dataMap = new DataMap();
    dataMap.putString("msg", msg);
    dataMap.putLong("last_timestamp", last_timestamp);
    dataMap.putString("action_path", path);//eg. START_COLLECTOR_PATH
    Log.d(TAG, "sendReplyMsg dataMap=" + dataMap);
    if (showToast) {
        sendLocalToast(msg, length);
    }
    sendData(WEARABLE_REPLYMSG_PATH, dataMap.toByteArray());
}
 
Example 14
Source File: WatchUpdaterService.java    From AndroidAPS with GNU Affero General Public License v3.0 5 votes vote down vote up
private DataMap basalMap(long startTime, long endTime, double amount) {
    DataMap dm = new DataMap();
    dm.putLong("starttime", startTime);
    dm.putLong("endtime", endTime);
    dm.putDouble("amount", amount);
    return dm;
}
 
Example 15
Source File: ListenerService.java    From xDrip with GNU General Public License v3.0 5 votes vote down vote up
private synchronized DataMap getWearTreatmentsData(int count, long last_send_time, int min_count) {
    forceGoogleApiConnect();

    Log.d(TAG, "getWearTreatmentsData last_send_time:" + JoH.dateTimeText(last_send_time) + " max count=" + count + " min_count=" + min_count);

    Treatments last_log = Treatments.lastSystime();
    if (last_log != null) {
        Log.d(TAG, "getWearTreatmentsData last systimestamp: " + last_log.systimestamp + " " + JoH.dateTimeText((long) last_log.systimestamp));
    }

    if (last_log != null && last_log.systimestamp > 0 && last_send_time <= last_log.systimestamp) {//startTime
        long last_send_success = last_send_time;
        Log.d(TAG, "getWearTreatmentsData last_send_time < last_log.timestamp:" + JoH.dateTimeText((long) last_log.systimestamp));
        List<Treatments> logs = Treatments.latestForGraphSystime(count, last_send_time);
        if (!logs.isEmpty() && logs.size() > min_count) {
            //Log.d(TAG, "getWearLogData count = " + logs.size());
            DataMap entries = dataMap(last_log);
            final ArrayList<DataMap> dataMaps = new ArrayList<>(logs.size());
            for (Treatments log : logs) {
                dataMaps.add(dataMap(log));
                last_send_success = (long)log.systimestamp;
                //Log.d(TAG, "getWearTreatmentsData set last_send_sucess:" + JoH.dateTimeText(last_send_sucess) + " Log:" + log.toString());
            }
            entries.putLong("time", new Date().getTime()); // MOST IMPORTANT LINE FOR TIMESTAMP
            entries.putDataMapArrayList("entries", dataMaps);
            Log.i(TAG, "getWearTreatmentsData SYNCED treatments up to " + JoH.dateTimeText(last_send_success) + " count = " + logs.size());
            return entries;
        } else
            Log.i(TAG, "getWearTreatmentsData SYNCED treatments up to " + JoH.dateTimeText(last_send_success) + " count = 0");
    }
    return null;
}
 
Example 16
Source File: BgSendQueue.java    From xDrip-plus with GNU General Public License v3.0 5 votes vote down vote up
public static DataMap getSensorSteps(SharedPreferences prefs) {
    Log.d("BgSendQueue", "getSensorSteps");
    DataMap dataMap = new DataMap();
    final long t = System.currentTimeMillis();
    final PebbleMovement pm = PebbleMovement.last();
    final boolean show_steps = prefs.getBoolean("showSteps", true);
    final boolean show_heart_rate = prefs.getBoolean("showHeartRate", true);
    final boolean use_wear_health = prefs.getBoolean("use_wear_health", true);
    if (use_wear_health || show_steps) {
        boolean sameDay = pm != null ? ListenerService.isSameDay(t, pm.timestamp) : false;
        if (!sameDay) {
            dataMap.putInt("steps", 0);
            dataMap.putLong("steps_timestamp", t);
            Log.d("BgSendQueue", "getSensorSteps isSameDay false t=" + JoH.dateTimeText(t));
        }
        else {
            dataMap.putInt("steps", pm.metric);
            dataMap.putLong("steps_timestamp", pm.timestamp);
            Log.d("BgSendQueue", "getSensorSteps isSameDay true pm.timestamp=" + JoH.dateTimeText(pm.timestamp) + " metric=" + pm.metric);
        }
    }

    if (use_wear_health && show_heart_rate) {
        final HeartRate lastHeartRateReading = HeartRate.last();
        if (lastHeartRateReading != null) {
            dataMap.putInt("heart_rate", lastHeartRateReading.bpm);
            dataMap.putLong("heart_rate_timestamp", lastHeartRateReading.timestamp);
        }
    }
    return dataMap;
}
 
Example 17
Source File: RawDisplayDataBgEntriesTest.java    From AndroidAPS with GNU Affero General Public License v3.0 5 votes vote down vote up
private DataMap dataMapForEntries(long timestamp, double sgv) {
    DataMap entry = new DataMap();
    entry.putLong("timestamp", timestamp);
    entry.putDouble("sgvDouble", sgv);
    entry.putDouble("high", 160.0);
    entry.putDouble("low", 90.0);
    entry.putInt("color", 1);
    return entry;
}
 
Example 18
Source File: ListenerService.java    From xDrip-plus with GNU General Public License v3.0 5 votes vote down vote up
private synchronized DataMap getWearTreatmentsData(int count, long last_send_time, int min_count) {
    forceGoogleApiConnect();

    Log.d(TAG, "getWearTreatmentsData last_send_time:" + JoH.dateTimeText(last_send_time) + " max count=" + count + " min_count=" + min_count);

    Treatments last_log = Treatments.lastSystime();
    if (last_log != null) {
        Log.d(TAG, "getWearTreatmentsData last systimestamp: " + last_log.systimestamp + " " + JoH.dateTimeText((long) last_log.systimestamp));
    }

    if (last_log != null && last_log.systimestamp > 0 && last_send_time <= last_log.systimestamp) {//startTime
        long last_send_success = last_send_time;
        Log.d(TAG, "getWearTreatmentsData last_send_time < last_log.timestamp:" + JoH.dateTimeText((long) last_log.systimestamp));
        List<Treatments> logs = Treatments.latestForGraphSystime(count, last_send_time);
        if (!logs.isEmpty() && logs.size() > min_count) {
            //Log.d(TAG, "getWearLogData count = " + logs.size());
            DataMap entries = dataMap(last_log);
            final ArrayList<DataMap> dataMaps = new ArrayList<>(logs.size());
            for (Treatments log : logs) {
                dataMaps.add(dataMap(log));
                last_send_success = (long)log.systimestamp;
                //Log.d(TAG, "getWearTreatmentsData set last_send_sucess:" + JoH.dateTimeText(last_send_sucess) + " Log:" + log.toString());
            }
            entries.putLong("time", new Date().getTime()); // MOST IMPORTANT LINE FOR TIMESTAMP
            entries.putDataMapArrayList("entries", dataMaps);
            Log.i(TAG, "getWearTreatmentsData SYNCED treatments up to " + JoH.dateTimeText(last_send_success) + " count = " + logs.size());
            return entries;
        } else
            Log.i(TAG, "getWearTreatmentsData SYNCED treatments up to " + JoH.dateTimeText(last_send_success) + " count = 0");
    }
    return null;
}
 
Example 19
Source File: Emmet.java    From Wear-Emmet with Apache License 2.0 4 votes vote down vote up
private void sendDataMap(String path, Object proxy, Method method, Object[] args) throws Throwable {
    final PutDataMapRequest putDataMapRequest = PutDataMapRequest.create(path);

    DataMap datamap = putDataMapRequest.getDataMap();
    datamap.putString("timestamp", new Date().toString());
    datamap.putString(METHOD_NAME, method.getName());

    {
        ArrayList<DataMap> methodDataMapList = new ArrayList<>();

        for (Object argument : args) {
            DataMap map = new DataMap();

            if (argument instanceof Integer) {
                map.putString(PARAM_TYPE, TYPE_INT);
                map.putInt(PARAM_VALUE, (Integer) argument);
            } else if (argument instanceof Float) {
                map.putString(PARAM_TYPE, TYPE_FLOAT);
                map.putFloat(PARAM_VALUE, (Float) argument);
            } else if (argument instanceof Double) {
                map.putString(PARAM_TYPE, TYPE_DOUBLE);
                map.putDouble(PARAM_VALUE, (Double) argument);
            } else if (argument instanceof Long) {
                map.putString(PARAM_TYPE, TYPE_LONG);
                map.putLong(PARAM_VALUE, (Long) argument);
            } else if (argument instanceof String) {
                map.putString(PARAM_TYPE, TYPE_STRING);
                map.putString(PARAM_VALUE, (String) argument);
            } else {
                map.putString(PARAM_TYPE, argument.getClass().getName());
                String encoded = SerialisationUtilsGSON.serialize(argument);
                map.putString(PARAM_VALUE, encoded);
            }

            methodDataMapList.add(map);
        }

        datamap.putDataMapArrayList(METHOD_PARAMS, methodDataMapList);
    }

    if (ENABLE_LOG)
        Log.d(TAG, datamap.toString());

    if (mApiClient != null) {
        if (mApiClient.isConnected()) {
            sendDataMapRequest(putDataMapRequest);
        } else {
            mWaitingDataMapItems.add(putDataMapRequest);
            mApiClient.connect();
        }
    }
}
 
Example 20
Source File: ListenerService.java    From xDrip-plus with GNU General Public License v3.0 4 votes vote down vote up
private void sendSensorLocalMessage(int steps, long timestamp) {
    DataMap dataMap = new DataMap();
    dataMap.putInt("steps", steps);
    dataMap.putLong("steps_timestamp", timestamp);
    sendLocalMessage("steps", dataMap);
}