Guest User

Untitled

a guest
Feb 24th, 2018
90
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.30 KB | None | 0 0
  1. <uses-permission android:name="com.samsung.android.providers.context.permission.WRITE_USE_APP_FEATURE_SURVEY"/>
  2.  
  3. <uses-permission android:name="android.permission.INTERNET" />
  4. <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
  5.  
  6. @Override
  7. public void onErrorResponse(VolleyError error) {
  8. // TODO Auto-generated method stub
  9. android.util.Log.e("ERROR", "ERROR " + error.toString());
  10. android.util.Log.e("LOCALERRORMSG", "ERROR " + error.getLocalizedMessage());
  11. android.util.Log.e("ERRORMSG", "ERROR " + error.getMessage());
  12. }
  13.  
  14. public class CustomHeaderJsonObjectRequest extends JsonObjectRequest {
  15.  
  16. public CustomHeaderJsonObjectRequest(int method, String url, JSONObject jsonRequest, Response.Listener<JSONObject> listener, Response.ErrorListener errorListener) {
  17. super(method, url, jsonRequest, listener, errorListener);
  18. }
  19.  
  20. @Override
  21. public Map<String, String> getHeaders() throws AuthFailureError {
  22.  
  23. Map<String, String> headers = new HashMap<>();
  24. headers.put("User-Agent","Mozilla/5.0");
  25. return headers;
  26. }
  27.  
  28. @Override
  29. public String getBodyContentType()
  30. {
  31. return "application/json; charset=utf-8";
  32. }
  33.  
  34. }
Add Comment
Please, Sign In to add comment