use of org.pixmob.httpclient.GoogleAppEngineAuthenticator in project httpclient by pixmob.
the class GoogleAppEngineAuthTask method doRun.
@Override
protected void doRun() throws Exception {
final AccountManager am = (AccountManager) getContext().getSystemService(Context.ACCOUNT_SERVICE);
final Account[] accounts = am.getAccountsByType(GoogleAppEngineAuthenticator.GOOGLE_ACCOUNT_TYPE);
if (accounts == null || accounts.length == 0) {
throw new IllegalStateException("No Google account found");
}
final String gaeHost = "pushpushandroid.appspot.com";
final GoogleAppEngineAuthenticator auth = new GoogleAppEngineAuthenticator(getContext(), accounts[0], gaeHost);
final HttpClient hc = createClient();
hc.head("https://" + gaeHost).with(auth).execute();
}
Aggregations