For me, it worked,
final String basicAuth = "Basic " + Base64.encodeToString("user:password".getBytes(), Base64.NO_WRAP);
Apache HttpCLient:
request.setHeader("Authorization", basicAuth);
HttpUrlConnection:
connection.setRequestProperty ("Authorization", basicAuth);
More Related Contents:
- start an activity after button click
- Disable only one from the list Recyclerview in android [closed]
- How to decompile an apk and save project? [closed]
- Exception ‘open failed: EACCES (Permission denied)’ on Android
- Vertical (rotated) label in Android
- How can I display a list view in an Android Alert Dialog?
- How to check if AlarmManager already has an alarm set?
- Strange behavior with android orientation sensor
- Adding Table rows Dynamically in Android
- Android TextWatcher.afterTextChanged vs TextWatcher.onTextChanged
- Google In-App billing, IllegalArgumentException: Service Intent must be explicit, after upgrading to Android L Dev Preview
- How to resolve java.util.zip.ZipException?
- How to make a ActionBar like Google Play that fades in when scrolling
- How to make a smaller RatingBar?
- Dagger 2.10 Android subcomponents and builders
- Android overlay to grab ALL touch, and pass them on?
- ” app-release.apk” how to change this default generated apk name
- Android: integer from xml resource
- Android – ListView – performItemClick
- How to detect android cpu speed?
- Pass Parameter with Volley POST
- eclipse can’t find android.support.v4.widget.SwipeRefreshLayout
- Gradle flavors for android with custom source sets – what should the gradle files look like?
- How to pause android.speech.tts.TextToSpeech?
- OnCreateView called multiple times / Working with ActionBar and Fragments
- How to display static google map on android imageview?
- How to add a SearchWidget to the ActionBar?
- Styling EditText view with shape drawable to look similar to new holographic theme for Android < 3.0
- How to use camera flash/led as torch on a Samsung Galaxy Tab?
- BLE scan is not working when screen is off on Android 8.1.0