@Override public String toString() { return contentValues.toString(); }
private void deletaAllInGroup(Context context, long groupId) throws RemoteException, OperationApplicationException{ ContentValues values = new ContentValues(); values.put(ContactsContract.Groups._ID, groupId); getContentResolver().delete(ContactsContract.Groups.CONTENT_URI,values.toString(),null); }
public static void debug(Context c, String message) { //NOTE: only collect this aware_log if in a study for compliance checks if (!Aware.isStudy(c)) return; ContentValues log = new ContentValues(); log.put(Aware_Provider.Aware_Log.LOG_TIMESTAMP, System.currentTimeMillis()); log.put(Aware_Provider.Aware_Log.LOG_DEVICE_ID, Aware.getSetting(c, Aware_Preferences.DEVICE_ID)); log.put(Aware_Provider.Aware_Log.LOG_MESSAGE, message); if (Aware.DEBUG) Log.d(TAG, "Aware_Log: \n" + log.toString()); c.getContentResolver().insert(Aware_Provider.Aware_Log.CONTENT_URI, log); }
/** {@inheritDoc} */ @Override public Uri insert(Uri uri, ContentValues values) { LogUtils.LOGV(TAG, "insert(uri=" + uri + ", values=" + values.toString() + ")"); final SQLiteDatabase db = mOpenHelper.getWritableDatabase(); final int match = sUriMatcher.match(uri); Uri insertedUri; switch (match) { case HOSTS_LIST: { values.put(MediaContract.SyncColumns.UPDATED, System.currentTimeMillis()); long hostId = db.insertOrThrow(MediaDatabase.Tables.HOSTS, null, values); insertedUri = MediaContract.Hosts.buildHostUri(hostId); break; } default: { throw new UnsupportedOperationException("Unsuported uri: " + uri); } } context.getContentResolver().notifyChange(uri, null); return insertedUri; }
private void save_bluetooth_device(BluetoothAdapter btAdapter) { if (btAdapter == null) return; Cursor sensorBT = getContentResolver().query(Bluetooth_Sensor.CONTENT_URI, null, null, null, null); if (sensorBT == null || !sensorBT.moveToFirst()) { ContentValues rowData = new ContentValues(); rowData.put(Bluetooth_Sensor.TIMESTAMP, System.currentTimeMillis()); rowData.put(Bluetooth_Sensor.DEVICE_ID, Aware.getSetting(getApplicationContext(), Aware_Preferences.DEVICE_ID)); rowData.put(Bluetooth_Sensor.BT_ADDRESS, Encrypter.hashMac(getApplicationContext(), btAdapter.getAddress())); rowData.put(Bluetooth_Sensor.BT_NAME, Encrypter.hashSsid(getApplicationContext(), btAdapter.getName())); getContentResolver().insert(Bluetooth_Sensor.CONTENT_URI, rowData); if (Aware.DEBUG) Log.d(TAG, "Bluetooth local information: " + rowData.toString()); } if (sensorBT != null && !sensorBT.isClosed()) sensorBT.close(); }
@Override public void onClick(View v) { try { if (getExpirationThreshold() > 0 && expire_monitor != null) expire_monitor.cancel(true); ContentValues rowData = new ContentValues(); rowData.put(ESM_Provider.ESM_Data.ANSWER_TIMESTAMP, System.currentTimeMillis()); rowData.put(ESM_Provider.ESM_Data.ANSWER, feedback.getText().toString()); rowData.put(ESM_Provider.ESM_Data.STATUS, ESM.STATUS_ANSWERED); getActivity().getContentResolver().update(ESM_Provider.ESM_Data.CONTENT_URI, rowData, ESM_Provider.ESM_Data._ID + "=" + getID(), null); Intent answer = new Intent(ESM.ACTION_AWARE_ESM_ANSWERED); answer.putExtra(ESM.EXTRA_ANSWER, rowData.getAsString(ESM_Provider.ESM_Data.ANSWER)); getActivity().sendBroadcast(answer); if (Aware.DEBUG) Log.d(Aware.TAG, "Answer:" + rowData.toString()); esm_dialog.dismiss(); } catch (JSONException e) { e.printStackTrace(); } } });
@Override public void onClick(View v) { try { if (getExpirationThreshold() > 0 && expire_monitor != null) expire_monitor.cancel(true); ContentValues rowData = new ContentValues(); rowData.put(ESM_Provider.ESM_Data.ANSWER_TIMESTAMP, System.currentTimeMillis()); rowData.put(ESM_Provider.ESM_Data.ANSWER, feedback.getText().toString()); rowData.put(ESM_Provider.ESM_Data.STATUS, ESM.STATUS_ANSWERED); getActivity().getContentResolver().update(ESM_Provider.ESM_Data.CONTENT_URI, rowData, ESM_Provider.ESM_Data._ID + "=" + getID(), null); Intent answer = new Intent(ESM.ACTION_AWARE_ESM_ANSWERED); answer.putExtra(ESM.EXTRA_ANSWER, rowData.getAsString(ESM_Provider.ESM_Data.ANSWER)); getActivity().sendBroadcast(answer); if (Aware.DEBUG) Log.d(Aware.TAG, "Answer:" + rowData.toString()); esm_dialog.dismiss(); } catch (JSONException e) { e.printStackTrace(); } } });
@Override public void onClick(View v) { try { if (getExpirationThreshold() > 0 && expire_monitor != null) expire_monitor.cancel(true); ContentValues rowData = new ContentValues(); rowData.put(ESM_Provider.ESM_Data.ANSWER_TIMESTAMP, System.currentTimeMillis()); rowData.put(ESM_Provider.ESM_Data.ANSWER, selected_scale_progress); rowData.put(ESM_Provider.ESM_Data.STATUS, ESM.STATUS_ANSWERED); getContext().getContentResolver().update(ESM_Provider.ESM_Data.CONTENT_URI, rowData, ESM_Provider.ESM_Data._ID + "=" + getID(), null); Intent answer = new Intent(ESM.ACTION_AWARE_ESM_ANSWERED); answer.putExtra(ESM.EXTRA_ANSWER, rowData.getAsString(ESM_Provider.ESM_Data.ANSWER)); getActivity().sendBroadcast(answer); if (Aware.DEBUG) Log.d(Aware.TAG, "Answer:" + rowData.toString()); esm_dialog.dismiss(); } catch (JSONException e) { e.printStackTrace(); } } });
private void saveSensorDevice(Sensor sensor) { Cursor sensorInfo = getContentResolver().query(Gravity_Sensor.CONTENT_URI, null, null, null, null); if (sensorInfo == null || !sensorInfo.moveToFirst()) { ContentValues rowData = new ContentValues(); rowData.put(Gravity_Sensor.DEVICE_ID, Aware.getSetting(getApplicationContext(), Aware_Preferences.DEVICE_ID)); rowData.put(Gravity_Sensor.TIMESTAMP, System.currentTimeMillis()); rowData.put(Gravity_Sensor.MAXIMUM_RANGE, sensor.getMaximumRange()); rowData.put(Gravity_Sensor.MINIMUM_DELAY, sensor.getMinDelay()); rowData.put(Gravity_Sensor.NAME, sensor.getName()); rowData.put(Gravity_Sensor.POWER_MA, sensor.getPower()); rowData.put(Gravity_Sensor.RESOLUTION, sensor.getResolution()); rowData.put(Gravity_Sensor.TYPE, sensor.getType()); rowData.put(Gravity_Sensor.VENDOR, sensor.getVendor()); rowData.put(Gravity_Sensor.VERSION, sensor.getVersion()); getContentResolver().insert(Gravity_Sensor.CONTENT_URI, rowData); if (Aware.DEBUG) Log.d(TAG, "Gravity sensor: " + rowData.toString()); } if (sensorInfo != null && !sensorInfo.isClosed()) sensorInfo.close(); }
private void saveSensorDevice(Sensor sensor) { Cursor sensorInfo = getContentResolver().query(Rotation_Sensor.CONTENT_URI, null, null, null, null); if (sensorInfo == null || !sensorInfo.moveToFirst()) { ContentValues rowData = new ContentValues(); rowData.put(Rotation_Sensor.DEVICE_ID, Aware.getSetting(getApplicationContext(), Aware_Preferences.DEVICE_ID)); rowData.put(Rotation_Sensor.TIMESTAMP, System.currentTimeMillis()); rowData.put(Rotation_Sensor.MAXIMUM_RANGE, sensor.getMaximumRange()); rowData.put(Rotation_Sensor.MINIMUM_DELAY, sensor.getMinDelay()); rowData.put(Rotation_Sensor.NAME, sensor.getName()); rowData.put(Rotation_Sensor.POWER_MA, sensor.getPower()); rowData.put(Rotation_Sensor.RESOLUTION, sensor.getResolution()); rowData.put(Rotation_Sensor.TYPE, sensor.getType()); rowData.put(Rotation_Sensor.VENDOR, sensor.getVendor()); rowData.put(Rotation_Sensor.VERSION, sensor.getVersion()); getContentResolver().insert(Rotation_Sensor.CONTENT_URI, rowData); if (Aware.DEBUG) Log.d(TAG, "Rotation sensor info: " + rowData.toString()); } if (sensorInfo != null && !sensorInfo.isClosed()) sensorInfo.close(); }
private void saveSensorDevice(Sensor sensor) { Cursor sensorInfo = getContentResolver().query(Temperature_Sensor.CONTENT_URI, null, null, null, null); if (sensorInfo == null || !sensorInfo.moveToFirst()) { ContentValues rowData = new ContentValues(); rowData.put(Temperature_Sensor.DEVICE_ID, Aware.getSetting(getApplicationContext(), Aware_Preferences.DEVICE_ID)); rowData.put(Temperature_Sensor.TIMESTAMP, System.currentTimeMillis()); rowData.put(Temperature_Sensor.MAXIMUM_RANGE, sensor.getMaximumRange()); rowData.put(Temperature_Sensor.MINIMUM_DELAY, sensor.getMinDelay()); rowData.put(Temperature_Sensor.NAME, sensor.getName()); rowData.put(Temperature_Sensor.POWER_MA, sensor.getPower()); rowData.put(Temperature_Sensor.RESOLUTION, sensor.getResolution()); rowData.put(Temperature_Sensor.TYPE, sensor.getType()); rowData.put(Temperature_Sensor.VENDOR, sensor.getVendor()); rowData.put(Temperature_Sensor.VERSION, sensor.getVersion()); getContentResolver().insert(Temperature_Sensor.CONTENT_URI, rowData); if (Aware.DEBUG) Log.d(TAG, "Temperature sensor info: " + rowData.toString()); } if (sensorInfo != null && !sensorInfo.isClosed()) sensorInfo.close(); }
@Override public void onClick(View v) { try{ if (getExpirationThreshold() > 0 && expire_monitor != null) expire_monitor.cancel(true); ContentValues rowData = new ContentValues(); rowData.put(ESM_Provider.ESM_Data.ANSWER_TIMESTAMP, System.currentTimeMillis()); rowData.put(ESM_Provider.ESM_Data.ANSWER, ratingBar.getRating()); rowData.put(ESM_Provider.ESM_Data.STATUS, ESM.STATUS_ANSWERED); getContext().getContentResolver().update(ESM_Provider.ESM_Data.CONTENT_URI, rowData, ESM_Provider.ESM_Data._ID + "=" + getID(), null); Intent answer = new Intent(ESM.ACTION_AWARE_ESM_ANSWERED); answer.putExtra(ESM.EXTRA_ANSWER, rowData.getAsString(ESM_Provider.ESM_Data.ANSWER)); getActivity().sendBroadcast(answer); if (Aware.DEBUG) Log.d(Aware.TAG, "Answer:" + rowData.toString()); esm_dialog.dismiss(); } catch (JSONException e) { e.printStackTrace(); } } });
@Override public void onClick(View v) { try { if (getExpirationThreshold() > 0 && expire_monitor != null) expire_monitor.cancel(true); SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss Z"); ContentValues rowData = new ContentValues(); rowData.put(ESM_Provider.ESM_Data.ANSWER_TIMESTAMP, System.currentTimeMillis()); rowData.put(ESM_Provider.ESM_Data.ANSWER, dateFormat.format(datePicked.getTime())); rowData.put(ESM_Provider.ESM_Data.STATUS, ESM.STATUS_ANSWERED); getActivity().getContentResolver().update(ESM_Provider.ESM_Data.CONTENT_URI, rowData, ESM_Provider.ESM_Data._ID + "=" + getID(), null); Intent answer = new Intent(ESM.ACTION_AWARE_ESM_ANSWERED); answer.putExtra(ESM.EXTRA_ANSWER, rowData.getAsString(ESM_Provider.ESM_Data.ANSWER)); getActivity().sendBroadcast(answer); if (Aware.DEBUG) Log.d(Aware.TAG, "Answer:" + rowData.toString()); esm_dialog.dismiss(); } catch (JSONException e) { e.printStackTrace(); } } });
@Override public void onClick(View v) { try { if (getExpirationThreshold() > 0 && expire_monitor != null) expire_monitor.cancel(true); ContentValues rowData = new ContentValues(); rowData.put(ESM_Provider.ESM_Data.ANSWER_TIMESTAMP, System.currentTimeMillis()); rowData.put(ESM_Provider.ESM_Data.STATUS, ESM.STATUS_ANSWERED); rowData.put(ESM_Provider.ESM_Data.ANSWER, (String) answer.getText()); getContext().getContentResolver().update(ESM_Provider.ESM_Data.CONTENT_URI, rowData, ESM_Provider.ESM_Data._ID + "=" + getID(), null); Intent answer = new Intent(ESM.ACTION_AWARE_ESM_ANSWERED); answer.putExtra(ESM.EXTRA_ANSWER, rowData.getAsString(ESM_Provider.ESM_Data.ANSWER)); getActivity().sendBroadcast(answer); if (Aware.DEBUG) Log.d(Aware.TAG, "Answer:" + rowData.toString()); esm_dialog.dismiss(); } catch (JSONException e) { e.printStackTrace(); } } });
private void saveSensorDevice(Sensor sensor) { Cursor sensorInfo = getContentResolver().query(Proximity_Sensor.CONTENT_URI, null, null, null, null); if (sensorInfo == null || !sensorInfo.moveToFirst()) { ContentValues rowData = new ContentValues(); rowData.put(Proximity_Sensor.DEVICE_ID, Aware.getSetting(getApplicationContext(), Aware_Preferences.DEVICE_ID)); rowData.put(Proximity_Sensor.TIMESTAMP, System.currentTimeMillis()); rowData.put(Proximity_Sensor.MAXIMUM_RANGE, sensor.getMaximumRange()); rowData.put(Proximity_Sensor.MINIMUM_DELAY, sensor.getMinDelay()); rowData.put(Proximity_Sensor.NAME, sensor.getName()); rowData.put(Proximity_Sensor.POWER_MA, sensor.getPower()); rowData.put(Proximity_Sensor.RESOLUTION, sensor.getResolution()); rowData.put(Proximity_Sensor.TYPE, sensor.getType()); rowData.put(Proximity_Sensor.VENDOR, sensor.getVendor()); rowData.put(Proximity_Sensor.VERSION, sensor.getVersion()); getContentResolver().insert(Proximity_Sensor.CONTENT_URI, rowData); if (Aware.DEBUG) Log.d(TAG, "Proximity sensor: " + rowData.toString()); } if (sensorInfo != null && !sensorInfo.isClosed()) sensorInfo.close(); }
private void saveSensorDevice(Sensor sensor) { if (sensor == null) return; Cursor sensorInfo = getContentResolver().query(Barometer_Sensor.CONTENT_URI, null, null, null, null); if (sensorInfo == null || !sensorInfo.moveToFirst()) { ContentValues rowData = new ContentValues(); rowData.put(Barometer_Sensor.DEVICE_ID, Aware.getSetting(getApplicationContext(), Aware_Preferences.DEVICE_ID)); rowData.put(Barometer_Sensor.TIMESTAMP, System.currentTimeMillis()); rowData.put(Barometer_Sensor.MAXIMUM_RANGE, sensor.getMaximumRange()); rowData.put(Barometer_Sensor.MINIMUM_DELAY, sensor.getMinDelay()); rowData.put(Barometer_Sensor.NAME, sensor.getName()); rowData.put(Barometer_Sensor.POWER_MA, sensor.getPower()); rowData.put(Barometer_Sensor.RESOLUTION, sensor.getResolution()); rowData.put(Barometer_Sensor.TYPE, sensor.getType()); rowData.put(Barometer_Sensor.VENDOR, sensor.getVendor()); rowData.put(Barometer_Sensor.VERSION, sensor.getVersion()); getContentResolver().insert(Barometer_Sensor.CONTENT_URI, rowData); if (Aware.DEBUG) Log.d(TAG, "Barometer sensor info: " + rowData.toString()); } if (sensorInfo != null && !sensorInfo.isClosed()) sensorInfo.close(); }
private void saveSensorDevice(Sensor sensor) { Cursor sensorInfo = getContentResolver().query(Light_Sensor.CONTENT_URI, null, null, null, null); if (sensorInfo == null || !sensorInfo.moveToFirst()) { ContentValues rowData = new ContentValues(); rowData.put(Light_Sensor.DEVICE_ID, Aware.getSetting(getApplicationContext(), Aware_Preferences.DEVICE_ID)); rowData.put(Light_Sensor.TIMESTAMP, System.currentTimeMillis()); rowData.put(Light_Sensor.MAXIMUM_RANGE, sensor.getMaximumRange()); rowData.put(Light_Sensor.MINIMUM_DELAY, sensor.getMinDelay()); rowData.put(Light_Sensor.NAME, sensor.getName()); rowData.put(Light_Sensor.POWER_MA, sensor.getPower()); rowData.put(Light_Sensor.RESOLUTION, sensor.getResolution()); rowData.put(Light_Sensor.TYPE, sensor.getType()); rowData.put(Light_Sensor.VENDOR, sensor.getVendor()); rowData.put(Light_Sensor.VERSION, sensor.getVersion()); getContentResolver().insert(Light_Sensor.CONTENT_URI, rowData); if (Aware.DEBUG) Log.d(TAG, "Light sensor info: " + rowData.toString()); } if (sensorInfo != null && !sensorInfo.isClosed()) sensorInfo.close(); }
private void saveAccelerometerDevice(Sensor acc) { Cursor accelInfo = getContentResolver().query(Linear_Accelerometer_Sensor.CONTENT_URI, null, null, null, null); if (accelInfo == null || !accelInfo.moveToFirst()) { ContentValues rowData = new ContentValues(); rowData.put(Linear_Accelerometer_Sensor.DEVICE_ID, Aware.getSetting(getApplicationContext(), Aware_Preferences.DEVICE_ID)); rowData.put(Linear_Accelerometer_Sensor.TIMESTAMP, System.currentTimeMillis()); rowData.put(Linear_Accelerometer_Sensor.MAXIMUM_RANGE, acc.getMaximumRange()); rowData.put(Linear_Accelerometer_Sensor.MINIMUM_DELAY, acc.getMinDelay()); rowData.put(Linear_Accelerometer_Sensor.NAME, acc.getName()); rowData.put(Linear_Accelerometer_Sensor.POWER_MA, acc.getPower()); rowData.put(Linear_Accelerometer_Sensor.RESOLUTION, acc.getResolution()); rowData.put(Linear_Accelerometer_Sensor.TYPE, acc.getType()); rowData.put(Linear_Accelerometer_Sensor.VENDOR, acc.getVendor()); rowData.put(Linear_Accelerometer_Sensor.VERSION, acc.getVersion()); getContentResolver().insert(Linear_Accelerometer_Sensor.CONTENT_URI, rowData); if (Aware.DEBUG) Log.d(TAG, "Linear-accelerometer sensor: " + rowData.toString()); } if (accelInfo != null && !accelInfo.isClosed()) accelInfo.close(); }
private void saveSensorDevice(Sensor sensor) { Cursor sensorInfo = getContentResolver().query(Magnetometer_Sensor.CONTENT_URI, null, null, null, null); if (sensorInfo == null || !sensorInfo.moveToFirst()) { ContentValues rowData = new ContentValues(); rowData.put(Magnetometer_Sensor.DEVICE_ID, Aware.getSetting(getApplicationContext(), Aware_Preferences.DEVICE_ID)); rowData.put(Magnetometer_Sensor.TIMESTAMP, System.currentTimeMillis()); rowData.put(Magnetometer_Sensor.MAXIMUM_RANGE, sensor.getMaximumRange()); rowData.put(Magnetometer_Sensor.MINIMUM_DELAY, sensor.getMinDelay()); rowData.put(Magnetometer_Sensor.NAME, sensor.getName()); rowData.put(Magnetometer_Sensor.POWER_MA, sensor.getPower()); rowData.put(Magnetometer_Sensor.RESOLUTION, sensor.getResolution()); rowData.put(Magnetometer_Sensor.TYPE, sensor.getType()); rowData.put(Magnetometer_Sensor.VENDOR, sensor.getVendor()); rowData.put(Magnetometer_Sensor.VERSION, sensor.getVersion()); getContentResolver().insert(Magnetometer_Sensor.CONTENT_URI, rowData); if (Aware.DEBUG) Log.d(TAG, "Magnetometer sensor: " + rowData.toString()); } if (sensorInfo != null && !sensorInfo.isClosed()) sensorInfo.close(); }
private void saveGyroscopeDevice(Sensor gyro) { Cursor gyroInfo = getContentResolver().query(Gyroscope_Sensor.CONTENT_URI, null, null, null, null); if (gyroInfo == null || !gyroInfo.moveToFirst()) { ContentValues rowData = new ContentValues(); rowData.put(Gyroscope_Sensor.DEVICE_ID, Aware.getSetting(getApplicationContext(), Aware_Preferences.DEVICE_ID)); rowData.put(Gyroscope_Sensor.TIMESTAMP, System.currentTimeMillis()); rowData.put(Gyroscope_Sensor.MAXIMUM_RANGE, gyro.getMaximumRange()); rowData.put(Gyroscope_Sensor.MINIMUM_DELAY, gyro.getMinDelay()); rowData.put(Gyroscope_Sensor.NAME, gyro.getName()); rowData.put(Gyroscope_Sensor.POWER_MA, gyro.getPower()); rowData.put(Gyroscope_Sensor.RESOLUTION, gyro.getResolution()); rowData.put(Gyroscope_Sensor.TYPE, gyro.getType()); rowData.put(Gyroscope_Sensor.VENDOR, gyro.getVendor()); rowData.put(Gyroscope_Sensor.VERSION, gyro.getVersion()); getContentResolver().insert(Gyroscope_Sensor.CONTENT_URI, rowData); Intent gyro_dev = new Intent(ACTION_AWARE_GYROSCOPE); gyro_dev.putExtra(EXTRA_SENSOR, rowData); sendBroadcast(gyro_dev); if (Aware.DEBUG) Log.d(TAG, "Gyroscope info: " + rowData.toString()); } if (gyroInfo != null && !gyroInfo.isClosed()) gyroInfo.close(); }