AppView 0.8.3
AppViewBackend Interface Reference

AppViewBackend allows you to extend the backend of AppView. More...

Classes

enum  TouchState
 

Public Member Functions

String getAppName ()
 Returns the name of the application that currently runs in the backend.
 
int getDensity ()
 Returns the density of the backend.
 
int getHeight ()
 Returns the height of the backend.
 
String getName ()
 Returns the name of the backend.
 
int getTextureId ()
 Returns the ID of the external GLES texture associated with the backend.
 
int getWidth ()
 Returns the width of the backend.
 
boolean initialize (int displayWidth, int displayHeight, int displayDensity)
 Initializes the backend with the specified parameters.
 
boolean injectPointerEvent (MotionEvent event)
 Injects a touch event to the backend.
 
boolean navigateBack ()
 Performs back navigation inside the backend.
 
void pauseApp ()
 Pauses the application inside the AppView backend.
 
void resumeApp ()
 Resumes the application inside the AppView backend.
 
void setContext (Context context)
 Sets the Android context.
 
boolean startApp (String appName, boolean canExitApp)
 Starts a given application inside the AppView backend.
 
boolean updateDisplay (int newDisplayWidth, int newDisplayHeight, int newDisplayDensity)
 Updates the virtual display parameters.
 
float[] updateTextureContent ()
 Updates pixels on an output texture.
 

Detailed Description

AppViewBackend allows you to extend the backend of AppView.

The available extension points are:

  • Virtual display management
  • Output texture management
  • Application startup method
  • Touch point injection

Member Function Documentation

◆ getAppName()

String getAppName ( )

Returns the name of the application that currently runs in the backend.

Returns
The application name. If the application is not running or is stopped, returns an empty string.

◆ getDensity()

int getDensity ( )

Returns the density of the backend.

Returns
The density of the backend.

◆ getHeight()

int getHeight ( )

Returns the height of the backend.

Returns
The height of the backend.

◆ getName()

String getName ( )

Returns the name of the backend.

Returns
The name of the backend.

◆ getTextureId()

int getTextureId ( )

Returns the ID of the external GLES texture associated with the backend.

Returns
The texture ID.

◆ getWidth()

int getWidth ( )

Returns the width of the backend.

Returns
The width of the backend.

◆ initialize()

boolean initialize ( int displayWidth,
int displayHeight,
int displayDensity )

Initializes the backend with the specified parameters.

When the backend is initialized, the getTextureId() returns a valid ID of the external GLES texture.

Parameters
displayWidthBackend width.
displayHeightBackend height.
displayDensityBackend density.
Returns
If successfully initialized, true, otherwise false.

◆ injectPointerEvent()

boolean injectPointerEvent ( MotionEvent event)

Injects a touch event to the backend.

AppView calls this method when a touch event happens at the area of the AppView node associated with the backend.

Parameters
eventMotionEvent instance.
Returns
If the event was injected to the backend, true, otherwise false.

◆ navigateBack()

boolean navigateBack ( )

Performs back navigation inside the backend.

This has the same effect as pressing the back button on an Android device.

Returns
If the back button press was delivered to the application, true, otherwise false.

◆ setContext()

void setContext ( Context context)

Sets the Android context.

Parameters
contextThe context of the hosting Android activity.

◆ startApp()

boolean startApp ( String appName,
boolean canExitApp )

Starts a given application inside the AppView backend.

Parameters
appNameThe name of the app formatted as "package.name/activity.name". See android.content.ComponentName.unflattenFromString().
canExitAppWhether to allow exiting the application with AppViewBackend#navigateBack().
Returns
If the application started successfully, true, otherwise false.

◆ updateDisplay()

boolean updateDisplay ( int newDisplayWidth,
int newDisplayHeight,
int newDisplayDensity )

Updates the virtual display parameters.

You cannot change the name of the virtual display after that display has been created.

Parameters
newDisplayWidthThe new width of the virtual display.
newDisplayHeightThe new height of the virtual display.
newDisplayDensityThe new density (dpi) of the virtual display.
Returns
On success, true, otherwise false.

◆ updateTextureContent()

float[] updateTextureContent ( )

Updates pixels on an output texture.

Returns
An array that contains the texture transformation matrix. Returns the same array every time, which is why the caller does not have to keep or modify the previous values.