use of com.android.volley.VolleyError in project easy by MehdiBenmesa.
the class RendezVousService method getRendezVousByTeacher.
private void getRendezVousByTeacher(String rdvState, final IRendezVous callBack) throws JSONException {
CustomRequestArray jsonReq = new CustomRequestArray(Request.Method.GET, GET_RDV_BY_TEACHER + "/" + rdvState + "/" + App.getInstance().getUser().getString("_id"), null, new Response.Listener<JSONArray>() {
@Override
public void onResponse(JSONArray response) {
callBack.onDataRecieved(response);
// recyclerViewRendeVous.setAdapter(new TestRecyclerViewAdapter(response));
}
}, new Response.ErrorListener() {
@Override
public void onErrorResponse(VolleyError error) {
}
});
App.getInstance().addToRequestQueue(jsonReq);
}
use of com.android.volley.VolleyError in project easy by MehdiBenmesa.
the class RendezVousService method getRendeVousByStudent.
private void getRendeVousByStudent(String rdvState, final IRendezVous callBack) throws JSONException {
CustomRequestArray jsonReq = new CustomRequestArray(Request.Method.GET, GET_RDV_BY_STUDENT + "/" + rdvState + "/" + App.getInstance().getUser().getString("_id"), null, new Response.Listener<JSONArray>() {
@Override
public void onResponse(JSONArray response) {
callBack.onDataRecieved(response);
// recyclerViewRendeVous.setAdapter(new TestRecyclerViewAdapter(response));
}
}, new Response.ErrorListener() {
@Override
public void onErrorResponse(VolleyError error) {
}
});
App.getInstance().addToRequestQueue(jsonReq);
}
use of com.android.volley.VolleyError in project easy by MehdiBenmesa.
the class ModuleService method getModulesByStudent.
public void getModulesByStudent(final IModule callBack) {
try {
CustomRequestArray jsonReq = new CustomRequestArray(Request.Method.GET, GET_MODULES_BY_STUDENT + "/" + App.getInstance().getUser().getString("section") + "/" + App.getInstance().getUser().getString("groupe"), null, new Response.Listener<JSONArray>() {
@Override
public void onResponse(JSONArray response) {
callBack.onDataRecieved(response);
}
}, new Response.ErrorListener() {
@Override
public void onErrorResponse(VolleyError error) {
}
});
App.getInstance().addToRequestQueue(jsonReq);
} catch (JSONException e) {
e.printStackTrace();
}
}
use of com.android.volley.VolleyError in project easy by MehdiBenmesa.
the class ModuleService method getModulesByTeacher.
private void getModulesByTeacher(final IModule callBack) throws JSONException {
// dialogListner.showDialog();
/* Starting Download Service */
CustomRequestArray jsonReq = new CustomRequestArray(Request.Method.GET, GET_MODULES_BY_TEACHER + "/" + App.getInstance().getUser().getString("_id"), null, new Response.Listener<JSONArray>() {
@Override
public void onResponse(JSONArray response) {
callBack.onDataRecieved(response);
}
}, new Response.ErrorListener() {
@Override
public void onErrorResponse(VolleyError error) {
}
});
App.getInstance().addToRequestQueue(jsonReq);
}
use of com.android.volley.VolleyError in project WordPress-Android by wordpress-mobile.
the class NotificationsUtils method registerDeviceForPushNotifications.
public static void registerDeviceForPushNotifications(final Context ctx, String token) {
SharedPreferences settings = PreferenceManager.getDefaultSharedPreferences(ctx);
String uuid = settings.getString(WPCOM_PUSH_DEVICE_UUID, null);
if (uuid == null)
return;
String deviceName = DeviceUtils.getInstance().getDeviceName(ctx);
Map<String, String> contentStruct = new HashMap<>();
contentStruct.put("device_token", token);
contentStruct.put("device_family", "android");
contentStruct.put("device_name", deviceName);
contentStruct.put("device_model", Build.MANUFACTURER + " " + Build.MODEL);
contentStruct.put("app_version", WordPress.versionName);
contentStruct.put("version_code", String.valueOf(PackageUtils.getVersionCode(ctx)));
contentStruct.put("os_version", Build.VERSION.RELEASE);
contentStruct.put("device_uuid", uuid);
RestRequest.Listener listener = new RestRequest.Listener() {
@Override
public void onResponse(JSONObject jsonObject) {
AppLog.d(T.NOTIFS, "Register token action succeeded");
try {
String deviceID = jsonObject.getString("ID");
if (deviceID == null) {
AppLog.e(T.NOTIFS, "Server response is missing of the device_id. Registration skipped!!");
return;
}
SharedPreferences settings = PreferenceManager.getDefaultSharedPreferences(ctx);
SharedPreferences.Editor editor = settings.edit();
editor.putString(WPCOM_PUSH_DEVICE_SERVER_ID, deviceID);
editor.apply();
AppLog.d(T.NOTIFS, "Server response OK. The device_id: " + deviceID);
} catch (JSONException e1) {
AppLog.e(T.NOTIFS, "Server response is NOT ok, registration skipped.", e1);
}
}
};
RestRequest.ErrorListener errorListener = new RestRequest.ErrorListener() {
@Override
public void onErrorResponse(VolleyError volleyError) {
AppLog.e(T.NOTIFS, "Register token action failed", volleyError);
}
};
WordPress.getRestClientUtils().post("/devices/new", contentStruct, null, listener, errorListener);
}
Aggregations