AI2 Component  (Version nb184)
com.google.appinventor.components.runtime.FusiontablesControl Class Reference
Inheritance diagram for com.google.appinventor.components.runtime.FusiontablesControl:
com.google.appinventor.components.runtime.AndroidNonvisibleComponent com.google.appinventor.components.runtime.Component com.google.appinventor.components.runtime.Component

Public Member Functions

 FusiontablesControl (ComponentContainer componentContainer)
 
boolean UseServiceAuthentication ()
 
void UseServiceAuthentication (boolean bool)
 
String ServiceAccountEmail ()
 
void ServiceAccountEmail (String email)
 
void ApiKey (String apiKey)
 
String ApiKey ()
 
void Query (String query)
 
String Query ()
 
void KeyFile (String path)
 
String KeyFile ()
 
void SendQuery ()
 
void DoQuery ()
 
void GotResult (String result)
 
void ForgetLogin ()
 
void InsertRow (String tableId, String columns, String values)
 
void GetRows (String tableId, String columns)
 
void GetRowsWithConditions (String tableId, String columns, String conditions)
 
void LoadingDialogMessage (String loadingDialogMessage)
 
String LoadingDialogMessage ()
 
void ShowLoadingDialog (boolean showLoadingDialog)
 
boolean ShowLoadingDialog ()
 
com.google.api.client.http.HttpResponse sendQuery (String query, String authToken)
 
void handleOAuthError (String msg)
 
- Public Member Functions inherited from com.google.appinventor.components.runtime.AndroidNonvisibleComponent
HandlesEventDispatching getDispatchDelegate ()
 

Static Public Member Functions

static String httpResponseToString (com.google.api.client.http.HttpResponse response)
 
static String httpApacheResponseToString (org.apache.http.HttpResponse response)
 
static String parseResponse (InputStream input)
 

Static Public Attributes

static final String FUSIONTABLES_POST = "https://www.googleapis.com/fusiontables/v2/tables"
 
static final String AUTHORIZATION_HEADER_PREFIX = "Bearer "
 
static final String AUTH_TOKEN_TYPE_FUSIONTABLES = "oauth2:https://www.googleapis.com/auth/fusiontables"
 
static final String APP_NAME = "App Inventor"
 
- Static Public Attributes inherited from com.google.appinventor.components.runtime.Component
static final String ASSET_DIRECTORY = "component"
 
static final int ALIGNMENT_NORMAL = 0
 
static final int ALIGNMENT_CENTER = 1
 
static final int ALIGNMENT_OPPOSITE = 2
 
static final int ACCELEROMETER_SENSITIVITY_WEAK = 1
 
static final int ACCELEROMETER_SENSITIVITY_MODERATE = 2
 
static final int ACCELEROMETER_SENSITIVITY_STRONG = 3
 
static final int BUTTON_SHAPE_DEFAULT = 0
 
static final int BUTTON_SHAPE_ROUNDED = 1
 
static final int BUTTON_SHAPE_RECT = 2
 
static final int BUTTON_SHAPE_OVAL = 3
 
static final int COLOR_NONE = 0x00FFFFFF
 
static final int COLOR_BLACK = 0xFF000000
 
static final int COLOR_BLUE = 0xFF0000FF
 
static final int COLOR_CYAN = 0xFF00FFFF
 
static final int COLOR_DKGRAY = 0xFF444444
 
static final int COLOR_GRAY = 0xFF888888
 
static final int COLOR_GREEN = 0xFF00FF00
 
static final int COLOR_LTGRAY = 0xFFCCCCCC
 
static final int COLOR_MAGENTA = 0xFFFF00FF
 
static final int COLOR_ORANGE = 0xFFFFC800
 
static final int COLOR_PINK = 0xFFFFAFAF
 
static final int COLOR_RED = 0xFFFF0000
 
static final int COLOR_WHITE = 0xFFFFFFFF
 
static final int COLOR_YELLOW = 0xFFFFFF00
 
static final int COLOR_DEFAULT = 0x00000000
 
static final String DEFAULT_VALUE_COLOR_NONE = "&H00FFFFFF"
 
static final String DEFAULT_VALUE_COLOR_BLACK = "&HFF000000"
 
static final String DEFAULT_VALUE_COLOR_BLUE = "&HFF0000FF"
 
static final String DEFAULT_VALUE_COLOR_CYAN = "&HFF00FFFF"
 
static final String DEFAULT_VALUE_COLOR_DKGRAY = "&HFF444444"
 
static final String DEFAULT_VALUE_COLOR_GRAY = "&HFF888888"
 
static final String DEFAULT_VALUE_COLOR_GREEN = "&HFF00FF00"
 
static final String DEFAULT_VALUE_COLOR_LTGRAY = "&HFFCCCCCC"
 
static final String DEFAULT_VALUE_COLOR_MAGENTA = "&HFFFF00FF"
 
static final String DEFAULT_VALUE_COLOR_ORANGE = "&HFFFFC800"
 
static final String DEFAULT_VALUE_COLOR_PINK = "&HFFFFAFAF"
 
static final String DEFAULT_VALUE_COLOR_RED = "&HFFFF0000"
 
static final String DEFAULT_VALUE_COLOR_WHITE = "&HFFFFFFFF"
 
static final String DEFAULT_VALUE_COLOR_YELLOW = "&HFFFFFF00"
 
static final String DEFAULT_VALUE_COLOR_DEFAULT = "&H00000000"
 
static final float FONT_DEFAULT_SIZE = 14
 
static final int LAYOUT_ORIENTATION_HORIZONTAL = ComponentConstants.LAYOUT_ORIENTATION_HORIZONTAL
 
static final int LAYOUT_ORIENTATION_VERTICAL = ComponentConstants.LAYOUT_ORIENTATION_VERTICAL
 
static final int SCALING_SCALE_PROPORTIONALLY = 0
 
static final int SCALING_SCALE_TO_FIT = 1
 
static final int TYPEFACE_DEFAULT = 0
 
static final int TYPEFACE_SANSSERIF = 1
 
static final int TYPEFACE_SERIF = 2
 
static final int TYPEFACE_MONOSPACE = 3
 
static final int LENGTH_PREFERRED = -1
 
static final int LENGTH_FILL_PARENT = -2
 
static final int LENGTH_UNKNOWN = -3
 
static final int LENGTH_PERCENT_TAG = -1000
 
static final int TOAST_LENGTH_SHORT = 0
 
static final int TOAST_LENGTH_LONG = 1
 
static final int DIRECTION_NORTH = 1
 
static final int DIRECTION_NORTHEAST = 2
 
static final int DIRECTION_EAST = 3
 
static final int DIRECTION_SOUTHEAST = 4
 
static final int DIRECTION_SOUTH = -1
 
static final int DIRECTION_SOUTHWEST = -2
 
static final int DIRECTION_WEST = -3
 
static final int DIRECTION_NORTHWEST = -4
 
static final int DIRECTION_NONE = 0
 
static final int DIRECTION_MIN = -4
 
static final int DIRECTION_MAX = 4
 
static float SLIDER_MIN_VALUE = 10
 
static float SLIDER_MAX_VALUE = 50
 
static float SLIDER_THUMB_VALUE = (SLIDER_MIN_VALUE + SLIDER_MAX_VALUE) / 2.0f
 
static final String DEFAULT_VALUE_TEXT_TO_SPEECH_COUNTRY = ""
 
static final String DEFAULT_VALUE_TEXT_TO_SPEECH_LANGUAGE = ""
 

Additional Inherited Members

- Protected Member Functions inherited from com.google.appinventor.components.runtime.AndroidNonvisibleComponent
 AndroidNonvisibleComponent (Form form)
 
- Protected Attributes inherited from com.google.appinventor.components.runtime.AndroidNonvisibleComponent
final Form form
 

Detailed Description

Appinventor fusiontables control.

This version has been migrated from the Fusiontables SQL API to the Fusiontables V1.0 API. And migrated yet again to the V2.0 API (6/29/2016 – JIS)

See https://developers.google.com/fusiontables/

The main change occurs in the way API requests are authorized. This version uses OAuth 2.0 and makes use of OAuth2Helper. The helper uses the Google AccountManager to acquire an access token that must be attached as the OAuth header in all Fusiontable Http requests.

Before a Fusiontable request can be made, the app must acquire an OAuth token. This may involve the user logging in to their Gmail account (or not if they are already logged in) and then being prompted to give the app permission to access the user's fusion tables.

Permission takes the form of an access token (called authToken), which must be transmitted to the Fusiontables service as part of all Http requests.

Definition at line 149 of file FusiontablesControl.java.

Constructor & Destructor Documentation

◆ FusiontablesControl()

com.google.appinventor.components.runtime.FusiontablesControl.FusiontablesControl ( ComponentContainer  componentContainer)

Definition at line 230 of file FusiontablesControl.java.

Member Function Documentation

◆ ApiKey() [1/2]

String com.google.appinventor.components.runtime.FusiontablesControl.ApiKey ( )

Getter for the API key.

Returns
apiKey the apiKey

Definition at line 322 of file FusiontablesControl.java.

◆ ApiKey() [2/2]

void com.google.appinventor.components.runtime.FusiontablesControl.ApiKey ( String  apiKey)

Setter for the app developer's API key.

Definition at line 310 of file FusiontablesControl.java.

◆ DoQuery()

void com.google.appinventor.components.runtime.FusiontablesControl.DoQuery ( )

Definition at line 386 of file FusiontablesControl.java.

◆ ForgetLogin()

void com.google.appinventor.components.runtime.FusiontablesControl.ForgetLogin ( )

Definition at line 409 of file FusiontablesControl.java.

◆ GetRows()

void com.google.appinventor.components.runtime.FusiontablesControl.GetRows ( String  tableId,
String  columns 
)

Definition at line 426 of file FusiontablesControl.java.

◆ GetRowsWithConditions()

void com.google.appinventor.components.runtime.FusiontablesControl.GetRowsWithConditions ( String  tableId,
String  columns,
String  conditions 
)

Definition at line 436 of file FusiontablesControl.java.

◆ GotResult()

void com.google.appinventor.components.runtime.FusiontablesControl.GotResult ( String  result)

Definition at line 400 of file FusiontablesControl.java.

◆ handleOAuthError()

void com.google.appinventor.components.runtime.FusiontablesControl.handleOAuthError ( String  msg)

Callback used for error reporting.

Parameters
msg

Definition at line 690 of file FusiontablesControl.java.

◆ httpApacheResponseToString()

static String com.google.appinventor.components.runtime.FusiontablesControl.httpApacheResponseToString ( org.apache.http.HttpResponse  response)
static

Handles Apache Http Response. Uses Apache's HttpResponse object, which is different from Google's.

Parameters
response
Returns
The result string

Definition at line 643 of file FusiontablesControl.java.

◆ httpResponseToString()

static String com.google.appinventor.components.runtime.FusiontablesControl.httpResponseToString ( com.google.api.client.http.HttpResponse  response)
static

Static utility method to prettify the HttpResponse. This version uses Google API HttpResponse object, which is different than Apache's

Parameters
response
Returns
resultString

Definition at line 620 of file FusiontablesControl.java.

◆ InsertRow()

void com.google.appinventor.components.runtime.FusiontablesControl.InsertRow ( String  tableId,
String  columns,
String  values 
)

Definition at line 417 of file FusiontablesControl.java.

◆ KeyFile() [1/2]

String com.google.appinventor.components.runtime.FusiontablesControl.KeyFile ( )

Definition at line 368 of file FusiontablesControl.java.

◆ KeyFile() [2/2]

void com.google.appinventor.components.runtime.FusiontablesControl.KeyFile ( String  path)

Definition at line 349 of file FusiontablesControl.java.

◆ LoadingDialogMessage() [1/2]

String com.google.appinventor.components.runtime.FusiontablesControl.LoadingDialogMessage ( )

Getter for the loading dialog's message.

Returns
loadingDialogMessage

Definition at line 458 of file FusiontablesControl.java.

◆ LoadingDialogMessage() [2/2]

void com.google.appinventor.components.runtime.FusiontablesControl.LoadingDialogMessage ( String  loadingDialogMessage)

Setter for the loading dialog's message.

Definition at line 447 of file FusiontablesControl.java.

◆ parseResponse()

static String com.google.appinventor.components.runtime.FusiontablesControl.parseResponse ( InputStream  input)
static

Parses the input stream returned from Http query

Parameters
input
Returns
The Result String

Definition at line 665 of file FusiontablesControl.java.

◆ Query() [1/2]

String com.google.appinventor.components.runtime.FusiontablesControl.Query ( )

Definition at line 342 of file FusiontablesControl.java.

◆ Query() [2/2]

void com.google.appinventor.components.runtime.FusiontablesControl.Query ( String  query)

Definition at line 329 of file FusiontablesControl.java.

◆ SendQuery()

void com.google.appinventor.components.runtime.FusiontablesControl.SendQuery ( )

Calls QueryProcessor to execute the API request asynchronously, if the user has already authenticated with the Fusiontables service.

Definition at line 377 of file FusiontablesControl.java.

◆ sendQuery()

com.google.api.client.http.HttpResponse com.google.appinventor.components.runtime.FusiontablesControl.sendQuery ( String  query,
String  authToken 
)

Executes a Fusiontable query with an OAuth 2.0 authenticated request. Requests are authenticated by attaching an Authentication header to the Http request. The header takes the form 'Authentication Oauth <access_token>'.

Requests take the form of SQL strings, using an Sql object from the Google API Client library. Apparently the Sql object handles the decision of whether the request should be a GET or a POST. Queries such as 'show tables' and 'select' are supposed to be GETs and queries such as 'insert' are supposed to be POSTS.

See https://developers.google.com/fusiontables/docs/v2/using

Parameters
querythe raw SQL string used by App Inventor
authTokenthe OAuth 2.0 access token
Returns
the HttpResponse if the request succeeded, or null

Definition at line 572 of file FusiontablesControl.java.

◆ ServiceAccountEmail() [1/2]

String com.google.appinventor.components.runtime.FusiontablesControl.ServiceAccountEmail ( )

Property for the service account email to use when using service authentication.

Definition at line 293 of file FusiontablesControl.java.

◆ ServiceAccountEmail() [2/2]

void com.google.appinventor.components.runtime.FusiontablesControl.ServiceAccountEmail ( String  email)

Definition at line 299 of file FusiontablesControl.java.

◆ ShowLoadingDialog() [1/2]

boolean com.google.appinventor.components.runtime.FusiontablesControl.ShowLoadingDialog ( )

Getter for the loading dialog's visibility.

Returns
True if the loading dialog should be shown, otherwise False.

Definition at line 479 of file FusiontablesControl.java.

◆ ShowLoadingDialog() [2/2]

void com.google.appinventor.components.runtime.FusiontablesControl.ShowLoadingDialog ( boolean  showLoadingDialog)

Setter for the loading dialog's visibility.

Definition at line 468 of file FusiontablesControl.java.

◆ UseServiceAuthentication() [1/2]

boolean com.google.appinventor.components.runtime.FusiontablesControl.UseServiceAuthentication ( )

Property to determine whether to use service authentication or user authentication. When this is checked, service authentication is used.

Definition at line 277 of file FusiontablesControl.java.

◆ UseServiceAuthentication() [2/2]

void com.google.appinventor.components.runtime.FusiontablesControl.UseServiceAuthentication ( boolean bool  )

Definition at line 283 of file FusiontablesControl.java.

Member Data Documentation

◆ APP_NAME

final String com.google.appinventor.components.runtime.FusiontablesControl.APP_NAME = "App Inventor"
static

Definition at line 164 of file FusiontablesControl.java.

◆ AUTH_TOKEN_TYPE_FUSIONTABLES

final String com.google.appinventor.components.runtime.FusiontablesControl.AUTH_TOKEN_TYPE_FUSIONTABLES = "oauth2:https://www.googleapis.com/auth/fusiontables"
static

Definition at line 163 of file FusiontablesControl.java.

◆ AUTHORIZATION_HEADER_PREFIX

final String com.google.appinventor.components.runtime.FusiontablesControl.AUTHORIZATION_HEADER_PREFIX = "Bearer "
static

Definition at line 161 of file FusiontablesControl.java.

◆ FUSIONTABLES_POST

final String com.google.appinventor.components.runtime.FusiontablesControl.FUSIONTABLES_POST = "https://www.googleapis.com/fusiontables/v2/tables"
static

Definition at line 156 of file FusiontablesControl.java.


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