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 () |
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 } });
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.
context | reference to a context |
naviType | type of navigation to be used |
licenseKey | license key for sidebar |
listener | listener 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 |