Android Google Calendar Service getting 鈥?00 Bad Request鈥?using ClientLogin

by Karim Varela » Thu, 19 May 2011 07:56:39 GMT


Sponsored Links
 I'm new to Google web services and not sure why my request is not
going through. I'm able to get my Auth token no problem using the
following code:

HttpClient client = new DefaultHttpClient();
String postURL = "https://www.google.com/accounts/ClientLogin";
HttpPost post = new HttpPost(postURL);
List<NameValuePair> params = new ArrayList<NameValuePair>();
params.add(new BasicNameValuePair("Email",
"karim.var...@gmail.com"));
params.add(new BasicNameValuePair("Passwd", "XXXXXX"));
params.add(new BasicNameValuePair("service", "cl"));
params.add(new BasicNameValuePair("accountType", "GOOGLE"));

UrlEncodedFormEntity ent = new
UrlEncodedFormEntity(params,HTTP.UTF_8);
post.setEntity(ent);
HttpResponse responsePOST = client.execute(post);
HttpEntity resEntity = responsePOST.getEntity();
if (resEntity != null) {
    String response = EntityUtils.toString(resEntity);
    authKey = response.substring( response.indexOf("Auth="),
response.length());
    authKey = authKey.replace( "Auth=","" );
 }


Then, I'm trying to make a simple call to get all the calendars for
karim.var...@gmail.com. As far as I know, it should be a simple GET to
https://www.google.com/calendar/feeds/default/allcalendars/full making
sure to set the header as get.setHeader("Authorization", "GoogleLogin
auth=" + authKey );. This is what I have:

HttpClient client = new DefaultHttpClient();
String getURL = "https://www.google.com/calendar/feeds/default/
allcalendars/full";
HttpGet get = new HttpGet(getURL);
get.setHeader("Authorization", "GoogleLogin auth=" + authKey );
get.setHeader("Content-Type", "application/atom+xml");
HttpResponse responseGet = client.execute(get);
HttpEntity resEntityGet = responseGet.getEntity();
if (resEntityGet != null) {
    String response = EntityUtils.toString( resEntityGet );
}

When this code is executed, however, I'm getting a "400 Bad Request"
and then farther down it says "Your client has issued a malformed or
illegal request." Can anybody please help me with this?

-- 



Other Threads

1. Acer Rilis Iconia, Tablet Honeycomb 4 Jutaan Mulai Besok

Untuk mereka yang tidak sabar menanti kehadiran tablet berbasis Honeycomb
seperti Motorola Xoom, Samsung Galaxy Tab 8.9 dan 10.1 ataupun LG Optimus
Pad, bersiaplah karena Acer Indonesia akan merilis tablet Acer Iconia
A500 dalam acara Acer Iconia Exhibiton di Senayan City Jakarta mulai besok
tanggal 6 April sampai 8 April 2011. Tablet yang akan di jual besok adalah
versi WiFi saja dengan model 16GB dan 32GB, tidak lupa ada promosi dengan
harga jual mulai dari 4,59 juta.

Tablet ini sudah didukung oleh prosesor dual core Nvidia Tegra 2 dengan
kecepatan 1GHz dan sudah memiliki plug in flash 10.2 yang memungkinkan untuk
menikmati akses internet tanpa batas, tentunya dengan jaringan WiFi. Acer
Iconia memiliki baterai 2 sel yang diklaim mampu tahan hingga 6 - 8 jam
untuk memutar video HD.

Berikut ini spesifikasi Acer Iconia A500 :

- Android Honeycomb 3.0
- 1GHz Dual-core Processor (NVIDIA Tegra 2 Chip)
- 1GB RAM
- 10.1 inch LCD Capacitive Touchscreen dengan resolusi 1280x800 pixels
- 5MP Rear-end Camera dengan kemampuan merekam video
- 2MP untuk Video Call
- 16GB onboard storage dengan microSD support hingga 64GB
- Graphics NVIDIA GeForce
- Konektivitas - WiFi, USB connector, Micro HDMI port


<http://www.teknoup.com/news_images/8233/8233_10009_1.jpg>

 <http://www.teknoup.com/news_images/8233/8233_10010_1.jpg>

 <http://www.teknoup.com/news_images/8233/8233_10011_1.jpg>


-- 
regard,


MirzaAhmad





www.mirzais.posterous.com
www.twitter.com/bangmirza

-- 
"

2. Old uninstalled app still in My Apps?

Several months ago I installed an app called Cardio from the Market, 
then later when I chose to remove it, it did uninstall itself, I see 
no traces of it on my HTC Evo 4G, but that darned app still shows up 
under My Apps. I even tried re-installing it just to unistall it 
again, but didn't work.


Is there anyway to make this badboy go away from My Apps?

TIA

elaine
c{*filter*}tesville, va

--
.

3. How to set the size and position of an image?

4. No built-in way for adb forward to bind to the host's network interface?

5. possible to use Bitmap as notification icon?

6. Style inheritance bug in API9 and higher?

7. Is it impossible to move and merge text on an image