C# Class AndroidHelper, project-tango-poc

Helper functions for common android functionality.
Mostra file Open project: stetro/project-tango-poc Class Usage Examples

Public Methods

Method Description
AndroidFinish ( ) : void

Calls finish on the Unity Activity.

AndroidQuit ( ) : void

Calls quit on the Unity Activity.

ApplicationHasTangoPermissions ( string permissionType ) : bool

Check if the application has a Tango permission.

GetCurrentApplicationLabel ( ) : string

Gets the current application label.

GetCurrentPackageName ( ) : string

Gets the name of the current package.

GetPackageInfo ( string packageName ) : AndroidJavaObject

Gets the package info.

GetScreenOrientation ( ) : int

Get native android orientation index.

GetTangoDeviceOrientation ( ) : TangoDeviceOrientation

Get the devices current and default orientations.

GetTangoHelperObject ( ) : AndroidJavaObject

Gets the Java tango helper object.

GetUnityActivity ( ) : AndroidJavaObject

Gets the unity activity.

GetVersionCode ( string packageName ) : int

Gets the version code.

GetVersionName ( string packageName ) : string

Gets the name of the version.

IsTangoCorePresent ( ) : bool

Check if the Tango Core package is installed.

IsTangoCoreUpToDate ( ) : bool

Check if the Tango Core package is up to date.

PerformanceLog ( string message ) : void

Used for performance logging from the Android side.

RegisterOnActivityResultEvent ( OnActivityResultEventHandler onActivityResult ) : void

Registers for the Android on activity result event.

RegisterOnScreenOrientationChangedEvent ( OnScreenOrientationChangedEventHandler onChanged ) : void

Registers for on orientaiton change event.

RegisterPauseEvent ( OnPauseEventHandler onPause ) : void

Registers for the Android pause event.

RegisterResumeEvent ( OnResumeEventHandler onResume ) : void

Registers for the Android resume event.

ShowAndroidToastMessage ( string message ) : void

Shows the android toast message.

ShowAndroidToastMessage ( string message, ToastLength length ) : void

Shows the android toast message.

ShowAndroidToastMessage ( string message, bool callFinish ) : void

Shows the android toast message.

StartActivity ( string className ) : void

Starts the activity for the provided class name.

StartTangoPermissionsActivity ( string permissionsType ) : void

Start the Tango permissions activity, requesting that permission.

Private Methods

Method Description
ConnectCloud ( ) : bool

Connects to the TangoCloudService.

DisconnectCloud ( ) : bool

Disconnects from the TangoCloudService.

StartExportADFActivity ( string srcAdfUuid, string exportLocation ) : void

Call export ADF permission activity.

StartImportADFActivity ( string adfPath ) : void

Call import ADF permission activity.

_RegisterCallbacks ( ) : void

Inializes the AndroidJavaProxy for the Android lifecycle callbacks.

_ShowAndroidToastMessage ( string message, ToastLength length ) : void

Shows the android toast message.

Method Details

AndroidFinish() public static method

Calls finish on the Unity Activity.
public static AndroidFinish ( ) : void
return void

AndroidQuit() public static method

Calls quit on the Unity Activity.
public static AndroidQuit ( ) : void
return void

ApplicationHasTangoPermissions() public static method

Check if the application has a Tango permission.
public static ApplicationHasTangoPermissions ( string permissionType ) : bool
permissionType string String for the permission.
return bool

GetCurrentApplicationLabel() public static method

Gets the current application label.
public static GetCurrentApplicationLabel ( ) : string
return string

GetCurrentPackageName() public static method

Gets the name of the current package.
public static GetCurrentPackageName ( ) : string
return string

GetPackageInfo() public static method

Gets the package info.
public static GetPackageInfo ( string packageName ) : AndroidJavaObject
packageName string Package name.
return UnityEngine.AndroidJavaObject

GetScreenOrientation() public static method

Get native android orientation index.
public static GetScreenOrientation ( ) : int
return int

GetTangoDeviceOrientation() public static method

Get the devices current and default orientations.
public static GetTangoDeviceOrientation ( ) : TangoDeviceOrientation
return TangoDeviceOrientation

GetTangoHelperObject() public static method

Gets the Java tango helper object.
public static GetTangoHelperObject ( ) : AndroidJavaObject
return AndroidJavaObject

GetUnityActivity() public static method

Gets the unity activity.
public static GetUnityActivity ( ) : AndroidJavaObject
return AndroidJavaObject

GetVersionCode() public static method

Gets the version code.
public static GetVersionCode ( string packageName ) : int
packageName string Package name.
return int

GetVersionName() public static method

Gets the name of the version.
public static GetVersionName ( string packageName ) : string
packageName string Package name.
return string

IsTangoCorePresent() public static method

Check if the Tango Core package is installed.
public static IsTangoCorePresent ( ) : bool
return bool

IsTangoCoreUpToDate() public static method

Check if the Tango Core package is up to date.
public static IsTangoCoreUpToDate ( ) : bool
return bool

PerformanceLog() public static method

Used for performance logging from the Android side.
public static PerformanceLog ( string message ) : void
message string Message string to log.
return void

RegisterOnActivityResultEvent() public static method

Registers for the Android on activity result event.
public static RegisterOnActivityResultEvent ( OnActivityResultEventHandler onActivityResult ) : void
onActivityResult OnActivityResultEventHandler On activity result.
return void

RegisterOnScreenOrientationChangedEvent() public static method

Registers for on orientaiton change event.
public static RegisterOnScreenOrientationChangedEvent ( OnScreenOrientationChangedEventHandler onChanged ) : void
onChanged OnScreenOrientationChangedEventHandler Delegate to call when the screen orientation changes.
return void

RegisterPauseEvent() public static method

Registers for the Android pause event.
public static RegisterPauseEvent ( OnPauseEventHandler onPause ) : void
onPause OnPauseEventHandler On pause.
return void

RegisterResumeEvent() public static method

Registers for the Android resume event.
public static RegisterResumeEvent ( OnResumeEventHandler onResume ) : void
onResume OnResumeEventHandler On resume.
return void

ShowAndroidToastMessage() public static method

Shows the android toast message.
public static ShowAndroidToastMessage ( string message ) : void
message string Message string to show in the toast.
return void

ShowAndroidToastMessage() public static method

Shows the android toast message.
public static ShowAndroidToastMessage ( string message, ToastLength length ) : void
message string Message string to show in the toast.
length ToastLength Toast message time length.
return void

ShowAndroidToastMessage() public static method

Shows the android toast message.
public static ShowAndroidToastMessage ( string message, bool callFinish ) : void
message string Message string to show in the toast.
callFinish bool If set to true call finish on the unity activity.
return void

StartActivity() public static method

Starts the activity for the provided class name.
public static StartActivity ( string className ) : void
className string Class name.
return void

StartTangoPermissionsActivity() public static method

Start the Tango permissions activity, requesting that permission.
public static StartTangoPermissionsActivity ( string permissionsType ) : void
permissionsType string String for the permission to request.
return void