Progressing with uploading datapoints to the server...not working yet...
This commit is contained in:
@@ -17,6 +17,8 @@ import android.widget.TextView;
|
||||
import org.json.JSONException;
|
||||
import org.json.JSONObject;
|
||||
|
||||
import java.text.DateFormat;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.Date;
|
||||
|
||||
public class AuthenticateActivity extends AppCompatActivity
|
||||
@@ -150,8 +152,10 @@ public class AuthenticateActivity extends AppCompatActivity
|
||||
String jsonStr = "";
|
||||
JSONObject dataObj;
|
||||
try {
|
||||
DateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd'T'hh:mm:ss");
|
||||
jsonStr = "{HR:70}";
|
||||
dataObj = new JSONObject(jsonStr);
|
||||
dataObj.put("dataTime", dateFormat.format(new Date()));
|
||||
Log.v(TAG, "Creating Datapoint..."+dataObj.toString());
|
||||
mWac.createDatapoint(dataObj,10);
|
||||
} catch (JSONException e) {
|
||||
|
||||
@@ -225,6 +225,7 @@ public class WebApiConnection {
|
||||
JSONObject jsonObject = new JSONObject();
|
||||
try {
|
||||
jsonObject.put("eventId", String.valueOf(eventId));
|
||||
jsonObject.put("dataTime", dataObj.getString("dataTime"));
|
||||
jsonObject.put("dataJSON", dataObj.toString());
|
||||
} catch (JSONException e) {
|
||||
Log.e(TAG, "Error generating event JSON string");
|
||||
|
||||
Reference in New Issue
Block a user