Blackberry 7 Platform

This topic explains the prerequisites, the process of including and using Tally Authentication Library in the Blackberry 7 application project, and the available API/methods.

Prerequisites

Add images in the res folder in the project.

Including the Library in Blackberry 7 Project

To include Tally Authentication Library in your BlackBerry 7 application project

1. Right-click the project in which the authentication library to be used.

2. Click Build Path .

3. Select Configure Build Path .

4. Select Libraries tab.

5. Click Add external JARs .

6. Go to the folder where the Tally Authentication Library is located, select the .jar file, then click Open .

7. Select Order and Export tab.

8. Select .jar file for the Tally Authentication Library, if not already selected, and click OK .

Using the Library in Blackberry 7 Project

1. Create a Runnable object.

2. This Runnable object acts as a callback when the authentication is completed.

Runnable onScreenCloseCallback = new Runnable()

{

public void run()

{

String str = "Status : " + TallyLoginInterface. getStatus () +

"\nSessionID : " + TallyLoginInterface. getSessionID () +

"\nTally.NET ID:" + TallyLoginInterface. getTallyNetID () +

"\nError Code: " + TallyLoginInterface. getErrorCode () +

"\nError Desc: " + TallyLoginInterface. getErrorDescription () +

"\nLib version: " + TallyLoginInterface. getLibraryVersion ();

Status. show (str);

}

};

3. Create an object of class TallyLoginScreen. Pass the online/offline mode status, and the runnable object in the constructor.

final TallyLoginScreen loginScreen = new TallyLoginScreen(true, onScreenCloseCallback);

4. Set developer mode to true , when application is in testing phase.

TallyLoginInterface. setDeveloperMode ( true );

5. Push the login screen on the current screen. This is done on the main thread.

// run on UI thread

UiApplication. getUiApplication ().invokeLater( new Runnable()

{

public void run()

{

UiApplication. getUiApplication ().pushScreen(loginScreen);

}

});

API/Methods Provided

API/Methods

Purpose

void setOnlineMode(bool)

To set the mode (online/offline) in which library operates.

If not set, by default the library operates in offline environment.

bool getOnlineMode()

To get the current mode in which the library operates.

QString getTallyNetID()

To get the Tally.NET ID which the library has authenticated, either successfully or unsuccessfully.

QString getSessionID()

To get the session ID after successful authentication.

If the authentication is not successful, this method returns null.

Int getErrorCode()

To get the error code after unsuccessful authentication.

If the authentication is successful, this method returns 0.

QString getErrorDescription()

To get the error description corresponding to the error code after unsuccessful authentication.

If the authentication is successful, this method returns null.

QString getLibraryVersion()

To get the current version of the library.

int getStatus()

To get the status of authentication done by the library.

0– Failure

1– Success

void setDeveloperMode(bool)

To set the developer mode for the library.

In developer mode, the library points to the test server.

bool isDeveloperMode()

To check whether the library is currently working in developer mode or not.