AI2 Component
(Version nb184)
|
Public Member Functions | |
ClientLoginHelper (Activity activity, String service, String prompt, HttpClient client) | |
HttpResponse | execute (HttpUriRequest request) throws ClientProtocolException, IOException |
void | forgetAccountName () |
String | getAuthToken () throws ClientProtocolException |
Helper to manage ClientLogin authentications tokens. This interacts with the Google Account manager to add the client login specific Authentication headers on each http request. (Inspired by chenplim's "comm" package)
Definition at line 38 of file ClientLoginHelper.java.
com.google.appinventor.components.runtime.util.ClientLoginHelper.ClientLoginHelper | ( | Activity | activity, |
String | service, | ||
String | prompt, | ||
HttpClient | client | ||
) |
Create one of these for each HttpClient needing clientlogin authentication.
activity | An activity that can be used for user interaction. |
service | The application service class (e.g. "fusiontables"). |
prompt | The user prompt (if needed) to choose an account. |
client | The HttpClient to use (or null for a default one). |
Definition at line 59 of file ClientLoginHelper.java.
HttpResponse com.google.appinventor.components.runtime.util.ClientLoginHelper.execute | ( | HttpUriRequest | request | ) | throws ClientProtocolException, IOException |
Wraps an HttpClient.execute() to manage the authorization headers. This will add the proper Authorization header, and retry if the auth token has expired.
Implements com.google.appinventor.components.runtime.util.IClientLoginHelper.
Definition at line 92 of file ClientLoginHelper.java.
void com.google.appinventor.components.runtime.util.ClientLoginHelper.forgetAccountName | ( | ) |
Forget about the account the user chose. The AccountChooser remembers (in shared prefs) the chosen account. Call this if you want to change the account this service is associated with.
Implements com.google.appinventor.components.runtime.util.IClientLoginHelper.
Definition at line 117 of file ClientLoginHelper.java.
String com.google.appinventor.components.runtime.util.ClientLoginHelper.getAuthToken | ( | ) | throws ClientProtocolException |
Uses Google Account Manager to retrieve auth token that can be used to access various Google APIs – e.g., the Google Voice api.
Implements com.google.appinventor.components.runtime.util.IClientLoginHelper.
Definition at line 142 of file ClientLoginHelper.java.