Authentication

The generated package database class provides a default synchronization connection profile according to the Unwired Server connection profile and Server Domain selected during code generation. You can log in to the Unwired Server with your user name and credentials.

The package database class provides these methods for logging in to the Unwired Server:

OnlineLogin authenticates credentials against the Unwired Server.

OfflineLogin authenticates against the last successfully authenticated credentials. There is no communication with Unwired Server in this method.

LoginToSync synchronizes the KeyGenerator from the Unwired Server with the client. The KeyGenerator is an MBO for storing key values that are known to both the server and the client. On LoginToSync from the client, the server sends down a value that the client can use when creating new records (by using the method KeyGenerator.generateId() to create key values that the server will accept).

The KeyGenerator value increments each time the GenerateId method is called. A periodic call to SubmitPending by the KeyGenerator MBO sends the most recently used value to the Unwired Server, to let the Unwired Server know what keys have been used on the client side. Place this call in a try/catch block in the client application and ensure that the client application does not attempt to send more messages to the Unwired Server if LoginToSync throws an exception.

void LoginToSync(string user, string password);