Hi all,
i'm trying oh so desperately hard to access the google maps data api
from within an Android app. I authenticate by using the ClientLogin
method (by the way, is this the best way to authenticate from within
Android applications?) and i receive an AuthID just fine.
Unfortunately, when i try to get map feeds, i get an "Internal Error"
or a status 500 from the server. I can see that the AuthID that i'm
providing is just fine, because if i provide a random garbage in the
"Authorization: GoogleLogin auth=" header, then i get a token invalid
error. Can anyone provide any insight into this?
Has anyone else accessed one of the Google Services successfuly, by
using the ClientLogin?
Here's my code, if it helps anyone answer my question, or to perhaps
resolve an unrelated question:
try {
URL url = new
URL("http://maps.google.com/maps/feeds/maps/default/
full");
HttpURLConnection connection = (HttpURLConnection)
url.openConnection();
//conn.setRequestProperty("Content-Type",
"application/x-www-form-
urlencoded");
connection.setRequestProperty("Authorization",
"GoogleLogin auth="
+ authID);
connection.setAllowUserInteraction(false);
connection.setDoOutput(false);
connection.setDoInput(true);
connection.setRequestMethod("GET");
//read inputstream here
InputStream in;
try{
connection.connect();
in = connection.getInputStream();
}
catch( IOException e ){
BufferedReader reader = new BufferedReader(new
InputStreamReader(connection.getErrorStream()));
String line;
String totalError = "";
while ((line =
reader.readLine()) != null) {
totalError =
totalError + line;
}
return totalError;
}
byte[] array=new byte[1024];
in.read(array,0,1024);
String result=new String(array);
connection.disconnect();
in.close();
return result;
}
catch( IOException e ){
// handle the error here
return "message is:" + e.getMessage();
}
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---