You need to set it to true if you want to send (output) a request body, for example with POST or PUT requests. With GET, you do not usually send a body, so you do not need it.
Sending the request body itself is done via the connection’s output stream:
conn.getOutputStream().write(someBytes);
More Related Contents:
- Apache HTTP client or URLConnection [duplicate]
- Android’s HttpURLConnection throws EOFException on HEAD requests
- Extracting only digits from a String [closed]
- how to increase counter on radio button is checked ? Android [closed]
- Date String to Milliseconds [duplicate]
- Mapbox Greyed out on dialog/Popup [closed]
- How to parse JSON Array (Not Json Object) in Android
- How to delete firebase data after “n” days
- Can’t create handler inside thread that has not called Looper.prepare() inside AsyncTask for ProgressDialog
- ANDROID: How to gain root access in an Android application?
- Android – How to take screenshot programmatically
- Registering a headset button click with BroadcastReceiver in Android
- customised listview using arrayadapter class in android
- Which Android Data Storage Technique to use?
- URLConnection getContentLength() is returning a negative value
- RecyclerView not calling onCreateViewHolder or onBindView
- Google SignIn API Exception 10
- What is the correct way to do inserts/updates/deletes in Android SQLiteDatabase using a query string?
- Android Days between two dates
- Android Studio Convert ISO string to “America/New_York” when adding to event to calendar
- java.lang.RuntimeException: takePicture failed
- How to print to the console in Android Studio?
- Google Maps API and custom polyline route between Markers
- Cant start service? (Speech recog)
- Android LocationServices.FusedLocationApi deprecated
- android studio with Java compiler error: string too large to encode using UTF-8 written instead as ‘STRING_TOO_LARGE’
- What is the maximum amount of data that a String can hold in java? [duplicate]
- Android keystore stopped working
- Recycler view – resizing item view while scrolling (for carousel like effect)
- Use my own Android app/apk as launcher/Home Screen Replacement