-
Notifications
You must be signed in to change notification settings - Fork 2
Open
Description
Hi Lintang Wisesa,
Thank you for the code for how to use Android App Inventor with favoriot.
I've been trying to use Android studio to access/read my data in favoriot, but no success.
I use jason object to get the favoriot data and put the API key in the header, but no success.
Any idea why?
Here is my soure code:
String url = "https://api.favoriot.com/v1/streams?device_developer_id=Soil_Moisture@atxxyy&max=1&order=DESC";
JsonObjectRequest jsonObjectRequest = new JsonObjectRequest(Request.Method.GET, url, null, new Response.Listener() {
@Override
public void onResponse(JSONObject response) {
Log.d(TAG, response.toString());
}
},
new Response.ErrorListener() {
@Override
public void onErrorResponse(VolleyError error) {
Log.d(TAG, error.toString());
}
}) {
@Override
public Map<String, String> getHeaders() throws AuthFailureError {
HashMap<String, String> headers = new HashMap<>();
String auth ="my auth key here"
headers.put("apikey", auth);
return headers;
}
}
};
queue.add(jsonObjectRequest);
Regards
Metadata
Metadata
Assignees
Labels
No labels