Java 3D Sidebar
 All Classes Namespaces Functions Variables
SidebarConnection Class Reference

This class is used to create and close connection to sidebar service. More...

Classes

class  ConnectionResult
 Result of the connection process. More...
 
interface  SidebarConnectionListener
 Interface definition for a callback to be invoked when connection process is finished. More...
 

Public Member Functions

void connect (Context context, NaviType naviType, String licenseKey, SidebarConnectionListener listener)
 Initiates the connection to the navigation. More...
 
void disconnect ()
 Disconnects from the navigation. More...
 

Static Public Member Functions

static SidebarConnection getInstance ()
 

Detailed Description

This class is used to create and close connection to sidebar service.

Connection must be established while using Sidebar object.

Example of creating the connection:

SidebarConnection.getInstance().connect(getApplicationContext(), NaviType.Truck, "0000000000000000", new SidebarConnectionListener() {
    
    public void onSidebarConnected(ConnectionResult result, Sidebar sidebar) {
        if(result.isConnected())
            mSidebar = sidebar; // Sidebar instance  
        else
            // we are not connected
    }
    
    public void onSidebarDisconnected() {
        // sidebar service was disconnected unexpectedly
    }
});

Member Function Documentation

void connect ( Context  context,
NaviType  naviType,
String  licenseKey,
SidebarConnectionListener  listener 
)

Initiates the connection to the navigation.

When succeeded, Sidebar instance is provided via listener's callback.

Parameters
contextreference to a context
naviTypetype of navigation to be used
licenseKeylicense key for sidebar
listenerlistener to a callback that will trigger when connected to navigation and sidebar is ready to be used.

References SidebarConnection.ConnectionResult.RESULT_FAILED_SERVICE_CONNECTION.

void disconnect ( )

Disconnects from the navigation.

This should be called when work with sidebar is finished. After this, sidebar can't be used.

References SidebarConnection.SidebarConnectionListener.onSidebarDisconnected().

static SidebarConnection getInstance ( )
static
Returns
instance of SidebarConnection