Database Reference
In-Depth Information
JSONObject newRecord = new JSONObject();
newRecord.put("id", deviceId);
newRecord.put("ts",
((double)
Calendar.getInstance().getTimeInMillis()) / 1000.0);
newRecord.put("screen_on",
((PowerManager)
getSystemService(Context.POWER_SERVICE)).isScreenOn());
newRecord.put("power", getPowerStatus());
ActivityManager activityManager =
(ActivityManager)
getSystemService(ACTIVITY_SERVICE);
newRecord.put("memory",
getMemory(activityManager));
if
(prefs.getBoolean(ManageActivity.LOCATION_STATE, true)
&&
lastLocation != null) {
newRecord.put("location",
getLocation(lastLocation));
}
if
(prefs.getBoolean(ManageActivity.APPLICATIONS_STATE,
true)) {
newRecord.put("running",
getRunning(activityManager));
}
return newRecord;
}
// ELIDED
private void appendToLog(JSONObject record) throws
IOException {
File currentLog = new File(getCacheDir(),
CURRENT_LOG);
if (currentLog.exists() && currentLog.length() >
MAX_LOG_SIZE) {
Search WWH ::




Custom Search