Setting up Application Properties

The Application instance contains the information and authentication credentials needed to register and connect to the Sybase Unwired Platform server.

The following code illustrates how to set up the minimum required fields:
// Initialize Application settings
Application app = Application.getInstance();

// The identifier has to match the application ID deployed to the SUP server
app.setApplicationIdentifier("SUP101");
// Set the android.content.Context for the application
app.setApplicationContext(context); // context is the android.content.Context

// ConnectionProperties has the infomation needed to register
// and connect to SUP server
ConnectionProperties connProps = app.getConnectionProperties();
connProps.setServerName("supserver.mycompany.com");
connProps.setPortNumber(5001);
// Other connection properties need to be set when connecting through relay server

// provide user credentials
LoginCredentials loginCred = new LoginCredentials("supAdmin", "supPwd");
connProps.setLoginCredentials(loginCred);

// Initialize generated package database class with this Application instance
SUP101DB.setApplication(app);
Note: setApplicationIdentifier and setApplicationContext must be called in the user interface thread.
Related reference
Application APIs