Advertisement
Guest User

Untitled

a guest
Jan 20th, 2019
65
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.98 KB | None | 0 0
  1. try
  2. {
  3. new AsyncTask<Void, Void, Void>() {
  4.  
  5. @Override
  6. protected Void doInBackground( Void... voids ) {
  7. try
  8. {
  9. URL url = new URL(SERVER_URI + "/notifications/delete/" + String.valueOf(notification.getId()));
  10. HttpURLConnection httpCon = (HttpURLConnection) url.openConnection();
  11. // httpCon.setDoOutput(true);
  12. // httpCon.setRequestProperty("Content-Type", "application/x-www-form-urlencoded" );
  13. // httpCon.setRequestMethod("DELETE");
  14. httpCon.setRequestProperty("X-HTTP-Method-Override", "DELETE");
  15. httpCon.setRequestMethod("DELETE");
  16. httpCon.connect();
  17.  
  18. Log.d("DELETE", String.valueOf(notification.getId()));
  19.  
  20. } catch(IOException e)
  21. {
  22. e.printStackTrace();
  23. }
  24. return null;
  25. }
  26. }.execute().get();
  27. } catch(InterruptedException e)
  28. {
  29. e.printStackTrace();
  30. } catch(ExecutionException e)
  31. {
  32. e.printStackTrace();
  33. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement