Snippits from WebHelper Class...
Using java Syntax Highlighting
- public List<Cookie> get() throws ClientProtocolException, IOException {
- httpget = new HttpGet(URL);
- response = httpclient.execute(httpget);
- entity = response.getEntity();
- if (entity != null) {
- entity.consumeContent();
- }
- return cookies = httpclient.getCookieStore().getCookies();
- }
- public List<Cookie> post(List<NameValuePair> postData) throws ClientProtocolException, IOException {
- httppost = new HttpPost(URL);
- nameValuePairs = postData;
- httppost.setEntity(new UrlEncodedFormEntity(nameValuePairs, HTTP.UTF_8));
- httppost.getParams().setBooleanParameter( "http.protocol.expect-continue", false );
- response = httpclient.execute(httppost);
- entity = response.getEntity();
- if (entity != null) {
- entity.consumeContent();
- }
- return cookies = httpclient.getCookieStore().getCookies();
- }
Parsed in 0.033 seconds, using GeSHi 1.0.8.4
Snippits from my Activity:
Using java Syntax Highlighting
- web.setURL("http://mydomain.com/login");
- web.get();
- List<NameValuePair> nvps = new ArrayList<NameValuePair>();
- nvps.add(new BasicNameValuePair("username", user.get(0).toString()));
- nvps.add(new BasicNameValuePair("password", user.get(1).toString()));
- List<Cookie> returnData = web.post(nvps);
- String successCookie = returnData.get(0).getName().toString();
- if (successCookie.equals("USERNAME")) {
- //Store User/Pass in DB
- }
Parsed in 0.032 seconds, using GeSHi 1.0.8.4
The weird thing is I am seeing the correct data on my emulator, but when I switch it over to my phone I do not get that data.
It is able to log in and I am able to see the cookies when I debug it on my phone, but I do not get logged in content. So it's behaving as if I am not logged in.
I am using the this permission:
Using xml Syntax Highlighting
- <uses-permission android:name="android.permission.INTERNET"></uses-permission>
Parsed in 0.000 seconds, using GeSHi 1.0.8.4
Is there something I am missing?
Thank you,
Andrew

