VoltAir
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Groups Pages
Classes | Public Member Functions | List of all members
com.google.fpl.voltair.VoltAirActivity Class Reference

Subclass of QtActivity to provide Android-specific functionality. More...

Inheritance diagram for com.google.fpl.voltair.VoltAirActivity:
com.google.fpl.utils.GooglePlayServicesHelper.SignInListener

Public Member Functions

void onCreate (Bundle savedInstanceState)
 Called when the activity is starting. More...
 
void onStart ()
 Called after onCreate() or onRestart() when the activity is being displayed to the user. More...
 
void onResume ()
 Called when the activity has returned to the foreground (although not necessarily having window focus) and is ready for user interaction. More...
 
void onPause ()
 Called when the activity is going into the background, but has not yet been killed. More...
 
void onStop ()
 Called when the activity is no longer visible to the user. More...
 
void onDestroy ()
 Called when the activity is finishing or being killed by the system. More...
 
void onActivityResult (int requestCode, int responseCode, Intent data)
 Called when an activity launched by this activity exits. More...
 
void onSignInFailed ()
 Callback for GPGS sign-in failure. More...
 
void onSignInSucceeded ()
 Callback for GPGS sign-in success. More...
 
void onStateConflict (AppStateManager.StateConflictResult result)
 Called when a conflict is detected while loading app state. More...
 
void onStateLoaded (AppStateManager.StateLoadedResult result)
 Called when app state data has been loaded successfully. More...
 
boolean dispatchGenericMotionEvent (MotionEvent event)
 Called to process (and possibly intercept) generic motion events. More...
 
boolean dispatchKeyEvent (KeyEvent event)
 Called to process (and possibly intercept) key events. More...
 
void onInputDeviceAdded (int deviceId)
 Called whenever an input device has been added to the system. More...
 
void onInputDeviceChanged (int deviceId)
 Called whenever the properties of an input device have changed since they were last queried. More...
 
void onInputDeviceRemoved (int deviceId)
 Called whenever an input device has been removed from the system. More...
 
int getTouchScreenDeviceId ()
 Returns the hardware deviceId of the touch screen input device, or -1 if none exists. More...
 
SoundManager getSoundManager ()
 Returns a reference to the Java-based SoundManager used for achieving gapless BGM playback. More...
 
boolean isSignedIntoCloud ()
 Returns true if currently signed into the cloud (i.e. GPGS). More...
 
boolean cloudSignInFailed ()
 Returns true if the most recent cloud (i.e. GPGS) sign-in attempt failed. More...
 
void signIntoCloud ()
 Begins asynchronous GPGS sign-in. More...
 
void signOutOfCloud ()
 Signs out of GPGS. More...
 
boolean ensureCloudSync ()
 Starts a GPGS AppStateManager save game data sync. More...
 
void saveToCloud (String data)
 Saves data to the GPGS AppStateManager. More...
 
void clearCloudData ()
 Resets AppStateManager save game data. More...
 
boolean revealAchievement (final String name)
 Reveals a GPGS achievement. More...
 
boolean unlockAchievement (final String name)
 Unlocks a GPGS achievement. More...
 
boolean incrementAchievement (String name, int numSteps)
 Increments a GPGS incremental achievement. More...
 
boolean setAchievementSteps (String name, int minSteps)
 Sets a GPGS incremental achievement to have a minimum number of steps. More...
 
void showAchievementsRequested ()
 Launch an Intent to show the GPGS achievements activity screen. More...
 
void resetAchievementsRequested ()
 Resets all GPGS achievement progress for the currently signed in user account. More...
 
String getVersionName ()
 Returns the version string of the Android application. More...
 
void setTrackerScreenName (String screenName, boolean sendScreenView)
 Sets the Google Analytics screen name and optionally sends a screen view hit. More...
 
void sendTrackerEvent (String category, String action)
 Sends an event hit to Google Analytics. More...
 
void sendTrackerEvent (String category, String action, String label)
 Sends an event hit to Google Analytics. More...
 
void sendTrackerEvent (String category, String action, String label, long value)
 Sends an event hit to Google Analytics. More...
 
void sendTrackerEvent (String category, String action, long value)
 Sends an event hit to Google Analytics. More...
 
native void onApplicationCreate ()
 Native callback for onCreate() lifecycle event. More...
 
native void onApplicationStart ()
 Native callback for onStart() lifecycle event. More...
 
native void onApplicationResume ()
 Native callback for onResume() lifecycle event. More...
 
native void onApplicationPause ()
 Native callback for onPause() lifecycle event. More...
 
native void onApplicationStop ()
 Native callback for onStop() lifecycle event. More...
 
native void onApplicationDestroy ()
 Native callback for onDestroy() lifecycle event. More...
 
native void onControllerDisconnect (int deviceId)
 Native callback for onInputDeviceRemoved(). More...
 
native boolean onGamepadMotionEvent (MotionEvent e)
 Native callback for dispatchGenericMotionEvent() of gamepad related MotionEvents. More...
 
native boolean onTouchNavigationMotionEvent (MotionEvent e)
 Native callback for dispatchGenericMotionEvent() of touch navigation related MotionEvents. More...
 
native boolean onGamepadKeyEvent (KeyEvent e)
 Native callback for dispatchKeyEvent() of gamepad related KeyEvents. More...
 
native boolean onTouchNavigationKeyEvent (KeyEvent e)
 Native callback for dispatchKeyEvent() of touch navigation related KeyEvents. More...
 
native boolean onKeyboardKeyEvent (KeyEvent e)
 Native callback for dispatchKeyEvent() of keyboard related KeyEvents. More...
 
native void onSignedIntoCloudChanged (boolean signedIntoCloud)
 Native callback for onSignInSucceeded() and onSignInFailed(). More...
 
native void onCloudDataLoaded (int statusCode, String data)
 Native callback for onStateLoaded(). More...
 
native String onCloudDataConflict (String localData, String serverData)
 Native callback for onStateConflict(). More...
 

Detailed Description

Subclass of QtActivity to provide Android-specific functionality.

This class is responsible for:

Member Function Documentation

void com.google.fpl.voltair.VoltAirActivity.clearCloudData ( )
inline

Resets AppStateManager save game data.

boolean com.google.fpl.voltair.VoltAirActivity.cloudSignInFailed ( )
inline

Returns true if the most recent cloud (i.e. GPGS) sign-in attempt failed.

boolean com.google.fpl.voltair.VoltAirActivity.dispatchGenericMotionEvent ( MotionEvent  event)
inline

Called to process (and possibly intercept) generic motion events.

Parameters
eventGeneric MotionEvent to handle
Returns
true if event was handled
boolean com.google.fpl.voltair.VoltAirActivity.dispatchKeyEvent ( KeyEvent  event)
inline

Called to process (and possibly intercept) key events.

Parameters
eventKeyEvent to handle
Returns
true if event was handled
boolean com.google.fpl.voltair.VoltAirActivity.ensureCloudSync ( )
inline

Starts a GPGS AppStateManager save game data sync.

Note
Must be signed into cloud to have this method return anything other than false.
Returns
true if a cloud sync has been started successfully
SoundManager com.google.fpl.voltair.VoltAirActivity.getSoundManager ( )
inline

Returns a reference to the Java-based SoundManager used for achieving gapless BGM playback.

int com.google.fpl.voltair.VoltAirActivity.getTouchScreenDeviceId ( )
inline

Returns the hardware deviceId of the touch screen input device, or -1 if none exists.

Note
If multiple touch screen devices are present, this returns the id of the first one discovered.
String com.google.fpl.voltair.VoltAirActivity.getVersionName ( )
inline

Returns the version string of the Android application.

boolean com.google.fpl.voltair.VoltAirActivity.incrementAchievement ( String  name,
int  numSteps 
)
inline

Increments a GPGS incremental achievement.

Note
It is currently the responsibility of the caller to buffer failed increments.
Parameters
nameAndroid resource name used to locate the achievement id
numStepsNumber of steps to increment the achievement
Returns
true if the achievement was successfully incremented
boolean com.google.fpl.voltair.VoltAirActivity.isSignedIntoCloud ( )
inline

Returns true if currently signed into the cloud (i.e. GPGS).

void com.google.fpl.voltair.VoltAirActivity.onActivityResult ( int  requestCode,
int  responseCode,
Intent  data 
)
inline

Called when an activity launched by this activity exits.

Parameters
requestCodeIdentifier supplied when the activity was originally launched
responseCodeStatus returned by the activity
dataIntent which can be used to return result data to the caller
native void com.google.fpl.voltair.VoltAirActivity.onApplicationCreate ( )

Native callback for onCreate() lifecycle event.

native void com.google.fpl.voltair.VoltAirActivity.onApplicationDestroy ( )

Native callback for onDestroy() lifecycle event.

native void com.google.fpl.voltair.VoltAirActivity.onApplicationPause ( )

Native callback for onPause() lifecycle event.

native void com.google.fpl.voltair.VoltAirActivity.onApplicationResume ( )

Native callback for onResume() lifecycle event.

native void com.google.fpl.voltair.VoltAirActivity.onApplicationStart ( )

Native callback for onStart() lifecycle event.

native void com.google.fpl.voltair.VoltAirActivity.onApplicationStop ( )

Native callback for onStop() lifecycle event.

native String com.google.fpl.voltair.VoltAirActivity.onCloudDataConflict ( String  localData,
String  serverData 
)

Native callback for onStateConflict().

Parameters
localDataString encoded local save game data that is in conflict
serverDataString encoded cloud save game data that is in conflict
native void com.google.fpl.voltair.VoltAirActivity.onCloudDataLoaded ( int  statusCode,
String  data 
)

Native callback for onStateLoaded().

Parameters
statusCodeStatus code indicating load result and possible errors
dataString encoded loaded save game data or null if loading error occurred
native void com.google.fpl.voltair.VoltAirActivity.onControllerDisconnect ( int  deviceId)

Native callback for onInputDeviceRemoved().

void com.google.fpl.voltair.VoltAirActivity.onCreate ( Bundle  savedInstanceState)
inline

Called when the activity is starting.

Initializes services for BGM, GPGS, and GA.

Parameters
savedInstanceStateBundle that contains the data that was most recently supplied by the activity through onSaveInstanceState()
void com.google.fpl.voltair.VoltAirActivity.onDestroy ( )
inline

Called when the activity is finishing or being killed by the system.

native boolean com.google.fpl.voltair.VoltAirActivity.onGamepadKeyEvent ( KeyEvent  e)

Native callback for dispatchKeyEvent() of gamepad related KeyEvents.

native boolean com.google.fpl.voltair.VoltAirActivity.onGamepadMotionEvent ( MotionEvent  e)

Native callback for dispatchGenericMotionEvent() of gamepad related MotionEvents.

void com.google.fpl.voltair.VoltAirActivity.onInputDeviceAdded ( int  deviceId)
inline

Called whenever an input device has been added to the system.

Parameters
deviceIdId of the input device that was added
void com.google.fpl.voltair.VoltAirActivity.onInputDeviceChanged ( int  deviceId)
inline

Called whenever the properties of an input device have changed since they were last queried.

Parameters
deviceIdId of the input device that has changed
void com.google.fpl.voltair.VoltAirActivity.onInputDeviceRemoved ( int  deviceId)
inline

Called whenever an input device has been removed from the system.

Parameters
deviceIdId of the input device that was removed
native boolean com.google.fpl.voltair.VoltAirActivity.onKeyboardKeyEvent ( KeyEvent  e)

Native callback for dispatchKeyEvent() of keyboard related KeyEvents.

void com.google.fpl.voltair.VoltAirActivity.onPause ( )
inline

Called when the activity is going into the background, but has not yet been killed.

void com.google.fpl.voltair.VoltAirActivity.onResume ( )
inline

Called when the activity has returned to the foreground (although not necessarily having window focus) and is ready for user interaction.

native void com.google.fpl.voltair.VoltAirActivity.onSignedIntoCloudChanged ( boolean  signedIntoCloud)

Native callback for onSignInSucceeded() and onSignInFailed().

Parameters
signedIntoCloudtrue if notifying of sign-in success
void com.google.fpl.voltair.VoltAirActivity.onSignInFailed ( )
inline

Callback for GPGS sign-in failure.

Implements com.google.fpl.utils.GooglePlayServicesHelper.SignInListener.

void com.google.fpl.voltair.VoltAirActivity.onSignInSucceeded ( )
inline

Callback for GPGS sign-in success.

Implements com.google.fpl.utils.GooglePlayServicesHelper.SignInListener.

void com.google.fpl.voltair.VoltAirActivity.onStart ( )
inline

Called after onCreate() or onRestart() when the activity is being displayed to the user.

Note
This may automatically kick off a GPGS sign-in flow. See GooglePlayServicesHelper::onStart for more information.
void com.google.fpl.voltair.VoltAirActivity.onStateConflict ( AppStateManager.StateConflictResult  result)
inline

Called when a conflict is detected while loading app state.

Parameters
resultResult retrieved from AppStateManager.StateResult with the conflicting data
void com.google.fpl.voltair.VoltAirActivity.onStateLoaded ( AppStateManager.StateLoadedResult  result)
inline

Called when app state data has been loaded successfully.

Parameters
resultResult retrieved from AppStateManager.StateResult with the loaded data
void com.google.fpl.voltair.VoltAirActivity.onStop ( )
inline

Called when the activity is no longer visible to the user.

native boolean com.google.fpl.voltair.VoltAirActivity.onTouchNavigationKeyEvent ( KeyEvent  e)

Native callback for dispatchKeyEvent() of touch navigation related KeyEvents.

native boolean com.google.fpl.voltair.VoltAirActivity.onTouchNavigationMotionEvent ( MotionEvent  e)

Native callback for dispatchGenericMotionEvent() of touch navigation related MotionEvents.

void com.google.fpl.voltair.VoltAirActivity.resetAchievementsRequested ( )
inline

Resets all GPGS achievement progress for the currently signed in user account.

Note
This function is for debug / testing purposes only and will not work on GPGS accounts no longer in staging.
boolean com.google.fpl.voltair.VoltAirActivity.revealAchievement ( final String  name)
inline

Reveals a GPGS achievement.

If currently offline, this method will reveal the achievement with an Android Toast instead of the GPGS' achievement notification.

Note
It is currently the responsibility of the caller to buffer failed reveals.
Parameters
nameAndroid resource name used to locate the achievement id
Returns
true if the achievement was successfully revealed
void com.google.fpl.voltair.VoltAirActivity.saveToCloud ( String  data)
inline

Saves data to the GPGS AppStateManager.

Parameters
dataString encoded save game data to save
void com.google.fpl.voltair.VoltAirActivity.sendTrackerEvent ( String  category,
String  action 
)
inline

Sends an event hit to Google Analytics.

Parameters
categoryCategory in which the event will be filed
actionAction associated with the event
void com.google.fpl.voltair.VoltAirActivity.sendTrackerEvent ( String  category,
String  action,
String  label 
)
inline

Sends an event hit to Google Analytics.

Parameters
categoryCategory in which the event will be filed
actionAction associated with the event
labelDescriptive label used for further differentiation of categorical actions
void com.google.fpl.voltair.VoltAirActivity.sendTrackerEvent ( String  category,
String  action,
String  label,
long  value 
)
inline

Sends an event hit to Google Analytics.

Parameters
categoryCategory in which the event will be filed
actionAction associated with the event
labelDescriptive label used for further differentiation of categorical actions
valueValue to be logged with the event
void com.google.fpl.voltair.VoltAirActivity.sendTrackerEvent ( String  category,
String  action,
long  value 
)
inline

Sends an event hit to Google Analytics.

Parameters
categoryCategory in which the event will be filed
actionAction associated with the event
valueValue to be logged with the event
boolean com.google.fpl.voltair.VoltAirActivity.setAchievementSteps ( String  name,
int  minSteps 
)
inline

Sets a GPGS incremental achievement to have a minimum number of steps.

Note
It is currently the responsibility of the caller to buffer failed sets.
Parameters
nameAndroid resource name used to locate the achievement id
minStepsLower bound for incremental progress
Returns
true if the achievement was successfully set to minSteps
void com.google.fpl.voltair.VoltAirActivity.setTrackerScreenName ( String  screenName,
boolean  sendScreenView 
)
inline

Sets the Google Analytics screen name and optionally sends a screen view hit.

Parameters
screenNameName of screen to be set
sendScreenViewtrue if a screen view hit should be sent
void com.google.fpl.voltair.VoltAirActivity.showAchievementsRequested ( )
inline

Launch an Intent to show the GPGS achievements activity screen.

void com.google.fpl.voltair.VoltAirActivity.signIntoCloud ( )
inline

Begins asynchronous GPGS sign-in.

void com.google.fpl.voltair.VoltAirActivity.signOutOfCloud ( )
inline

Signs out of GPGS.

boolean com.google.fpl.voltair.VoltAirActivity.unlockAchievement ( final String  name)
inline

Unlocks a GPGS achievement.

If currently offline, this method will unlock the achievement with an Android Toast instead of the GPGS' achievement notification.

Parameters
nameAndroid resource name used to locate the achievement id
Returns
true if the achievement was successfully unlocked