[android-developers] authorization token

2012-03-20 Thread ultravolks
Hello, 

I am trying to understand what the getResult method of AccountManagerFuture 
does.
I am working trying to authenticate in a development environment with GAE 
and my android phone.
When getResult is called and I my android phone is offline I get a 
IOException. 
03-19 13:58:03.933: W/System.err(1801): java.io.IOException
03-19 13:58:03.933: W/System.err(1801): at 
android.accounts.AccountManager.convertErrorToException(AccountManager.java:1419)
03-19 13:58:03.933: W/System.err(1801): at 
android.accounts.AccountManager.access$400(AccountManager.java:134)
03-19 13:58:03.933: W/System.err(1801): at 
android.accounts.AccountManager$AmsTask$Response.onError(AccountManager.java:1280)
03-19 13:58:03.933: W/System.err(1801): at 
android.accounts.IAccountManagerResponse$Stub.onTransact(IAccountManagerResponse.java:69)
03-19 13:58:03.933: W/System.err(1801): at 
android.os.Binder.execTransact(Binder.java:288)
03-19 13:58:03.933: W/System.err(1801): at 
dalvik.system.NativeStart.run(Native Method)


If it is online I can get an authorization token.
But I would like to operate completely off the Internet while I am 
developing. Is this possible? Sorry if it is banal, but could you tell me 
what getResult does  or if it 
gets the token from a Google server on the Internet?


 private String getAuthToken(AccountManagerFutureBundle future) {
try {
Bundle authTokenBundle = future.getResult();
String authToken = 
authTokenBundle.get(AccountManager.KEY_AUTHTOKEN).toString();
return authToken;
} catch (Exception e) {
   
return null;
}
}

-- 
You received this message because you are subscribed to the Google
Groups Android Developers group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

[android-developers] Authorization token from local GAE

2012-03-20 Thread ultravolks
Hello, is it possible to get an authorization token from a local Google App 
Engine without being connected to the Internet.
When I call AccountManagerFuture getResult() I can get a token only if I am 
connected to the Internet.
With the code below, If I am off line IOException shows up. Could you 
explain to me why or if there is a way to work offline?
Thanks in advance

private class GetAuthTokenCallback implements 
AccountManagerCallbackBundle {
public void run(AccountManagerFutureBundle result) {
Bundle bundle;
try {

bundle = result.getResult();

 Intent intent = (Intent)bundle.get(AccountManager.KEY_INTENT);
if(intent != null) {
// User input required
startActivity(intent);
} else {
onGetAuthToken(bundle);
}
} catch (OperationCanceledException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (AuthenticatorException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}

-- 
You received this message because you are subscribed to the Google
Groups Android Developers group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en