AI2 Component  (Version nb184)
com.google.appinventor.components.runtime.util.ClientLoginHelper Class Reference
Inheritance diagram for com.google.appinventor.components.runtime.util.ClientLoginHelper:
com.google.appinventor.components.runtime.util.IClientLoginHelper

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
 

Detailed Description

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.

Constructor & Destructor Documentation

◆ ClientLoginHelper()

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.

Parameters
activityAn activity that can be used for user interaction.
serviceThe application service class (e.g. "fusiontables").
promptThe user prompt (if needed) to choose an account.
clientThe HttpClient to use (or null for a default one).

Definition at line 59 of file ClientLoginHelper.java.

Member Function Documentation

◆ execute()

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.

◆ forgetAccountName()

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.

◆ getAuthToken()

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.


The documentation for this class was generated from the following file: