domenica, febbraio 06, 2011

Connet an Android app to Google App Engine - Authenticated !

Sometime ago I read a very interesting post on Nick'blog: "Authenticating against App Engine from an Android app"
The code was very intersting but I need to refactor a bit and I'd like to add some "utility" method.
Also I added a way to automatically invalidate old Auth token and get a new one.

My code (very alpha... I'm still working on it...) is here:

[Update: it manages http and https connections to GAE]


// ....
_gaeConnector = new GAEConnector(null, "");
if (!_gaeConnector.Authenticate(MyTest.this)) {
  message = "***AUTHENTICATION ERROR***";
// .....
if (_gaeConnector.isAuthenticated()) {
  int httpStatusCode = _gaeConnector.GETContent("/myurl", true, true);
  if (httpStatusCode == 200) {
    String content = _gaeConnector.getLastContent();
    // ....

Nessun commento: