Hello All,
I'm trying to build a simple application that logs in to a web backend,
using HTTPClient. Created a POST Request that sends some login
credentials, which works well.
My question is now: how can I use this opened Session for interaction
with StreamingMediaPlayer?
Code without using the logged in session is:
audioStreamer = new StreamingMediaPlayer(this, textStreamed,
playButton, streamButton, progressBar);
audioStreamer
.startStreaming(
"http://mydomain/audio.mp3",
1677, 214);
Thanks in Advance, Andi
PS: here is the Login code for completeness:
@Override
public void doLogin(String uri, String username, String password) {
List <NameValuePair> nvps = new ArrayList <NameValuePair>();
nvps.add(new BasicNameValuePair("username", username));
nvps.add(new BasicNameValuePair("password", password));
HttpClient client = new DefaultHttpClient();
HttpPost httpost = new HttpPost(PROTOCOL_PREFIX + uri);
try {
httpost.setEntity(new UrlEncodedFormEntity(nvps, HTTP.UTF_8));
// Post, check and show the result (not really
spectacular, but works):
client.execute(httpost, new BasicResponseHandler() {
@Override
public String handleResponse(HttpResponse response) {
HttpEntity entity = response.getEntity();
HttpParams params = response.getParams();
Log.i("LOGIN", "e: " + entity + " p: " + params);
return "";
}
});
} catch (Exception e) {
Log.e(getClass().getName(), "Error logging in: " +
e.getMessage(),
e);
}
}
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google
Groups "Android Beginners" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-beginners?hl=en
-~----------~----~----~----~------~----~------~--~---