Skip to Content
avatar image
Former Member

I am getting following error : Caused by: com.ianywhere.ultralitejni12.implementation.JniException: UltraLiteJ Error[-1497]: The synchronization failed because MobiLink returned authentication status '3' with value '3003'

My code is :


private void initializeApplicationOnline() {

// TODO Auto-generated method stub

Application app = Application.getInstance();

SharedPreferences settings = getSharedPreferences(PREFS_NAME, 0);

HOST = settings.getString("server", null);

Log.d(TAG, "host" + HOST);

PORT = settings.getInt("port", 0);

Log.d(TAG, "port" + PORT);



USERNAME = settings.getString("username", null);

PASSWORD = settings.getString("password", null);

Log.d(TAG, "user" + USERNAME);

Log.d(TAG, "pw" + PASSWORD);

if (!initializationDone) {


app.setApplicationIdentifier("HPDiscover");


app.setApplicationContext(this.getApplicationContext());


app.setApplicationCallback(new MyApplicationCallbackHandler());


HPDiscoverDB.registerCallbackHandler(new MyCallbackHandlerDB());


HPDiscoverDB.setApplication(app);


HPDiscoverDB.getSynchronizationProfile().setServerName(HOST);

}

ConnectionProperties connProps = app.getConnectionProperties();

LoginCredentials loginCredentials = new LoginCredentials(USERNAME,



PASSWORD);



connProps.setLoginCredentials(loginCredentials);

Log.d(TAG, "host" + HOST);

connProps.setServerName(HOST);

connProps.setPortNumber(PORT);



if (app.getRegistrationStatus() != RegistrationStatus.REGISTERED) {


Log.d(TAG, "Registering Application");


app.registerApplication(TIMEOUT);

} else {


Log.d(TAG, "Application already registered, Starting connection.");


app.startConnection(TIMEOUT);

}

if (!HPDiscoverDB.isSynchronized("Default")) {


SynchronizationGroup sg = HPDiscoverDB




.getSynchronizationGroup("Default");


sg.setEnableSIS(true);


sg.save();


HPDiscoverDB.synchronize(new MySyncListener());

}

HPDiscoverDB.enableChangeLog();

// Navigate here


}

class MyApplicationCallbackHandler implements ApplicationCallback {

public void onApplicationSettingsChanged(StringList arg0) {

// TODO Auto-generated method stub

Log.d(TAG, "OnApplicationSettingsChanged Called.");

}

public void onConnectionStatusChanged(int arg0, int arg1, String arg2) {

// TODO Auto-generated method stub

Log.d(TAG, "onConnectionStatusChanged Called.");

}

public void onDeviceConditionChanged(int arg0) {

// TODO Auto-generated method stub

Log.d(TAG, "onDeviceConditionChanged Called.");

}

public void onRegistrationStatusChanged(int arg0, int arg1, String arg2) {

// TODO Auto-generated method stub

Log.d(TAG, "onRegistrationStatusChanged Called.");

}

}

class MyCallbackHandlerDB extends DefaultCallbackHandler {

private String TAG = "***DiscoverApp***";

@Override

public int onSynchronize(GenericList<SynchronizationGroup> groups,

SynchronizationContext context) {

// TODO Auto-generated method stub

Log.d(TAG, "onSynchronize Called.");

return super.onSynchronize(groups, context);

}

@Override

public void onLoginSuccess() {

// TODO Auto-generated method stub

Log.d(TAG, "Login Success");

super.onLoginSuccess();

}

@Override

public void onLoginFailure() {

// TODO Auto-generated method stub

Log.d(TAG, "Login failure");

super.onLoginFailure();

}

}

class MySyncListener implements SyncStatusListener {

long start;

public MySyncListener() {

start = System.currentTimeMillis();

}

public boolean objectSyncStatus(ObjectSyncStatusData statusData) {

// TODO Auto-generated method stub

long now = System.currentTimeMillis();

long interval = now - start;

start = now;

String infoMessage;

int syncState = statusData.getSyncStatusState();

switch (syncState) {

case SyncStatusState.SYNC_STARTING:

infoMessage = "START [" + interval + "]";

break;

case SyncStatusState.APPLICATION_SYNC_SENDING_HEADER:

infoMessage = "SENDING HEADERS [" + interval + "]";

break;

case SyncStatusState.APPLICATION_SYNC_SENDING_SCHEMA:

infoMessage = "SENDING SCHEMA [" + interval + "]";

break;

case SyncStatusState.APPLICATION_DATA_UPLOADING:

infoMessage = "DATA UPLOADING [" + interval + "] "

+ statusData.getCurrentMBO() + ": (S>"

+ statusData.getSentByteCount() + ":"

+ statusData.getSentRowCount() + " R<"

+ statusData.getReceivedByteCount() + ":"

+ statusData.getReceivedRowCount() + ")";

break;

case SyncStatusState.APPLICATION_SYNC_RECEIVING_UPLOAD_ACK:

infoMessage = "RECEIVING UPLOAD ACK [" + interval + "]";

break;

case SyncStatusState.APPLICATION_DATA_UPLOADING_DONE:

infoMessage = "UPLOAD DONE [" + interval + "] "

+ statusData.getCurrentMBO() + ": (S>"

+ statusData.getSentByteCount() + ":"

+ statusData.getSentRowCount() + " R<"

+ statusData.getReceivedByteCount() + ":"

+ statusData.getReceivedRowCount() + ")";

break;

case SyncStatusState.APPLICATION_DATA_DOWNLOADING:

infoMessage = "DATA DOWNLOADING[" + interval + "] "

+ statusData.getCurrentMBO() + ": (S>"

+ statusData.getSentByteCount() + ":"

+ statusData.getSentRowCount() + " R<"

+ statusData.getReceivedByteCount() + ":"

+ statusData.getReceivedRowCount() + ")";

break;

case SyncStatusState.APPLICATION_SYNC_DISCONNECTING:

infoMessage = "DISCONNECTING [" + interval + "]";

break;

case SyncStatusState.APPLICATION_SYNC_COMMITTING_DOWNLOAD:

infoMessage = "COMMITTING DOWNLOAD [" + interval + "] "

+ statusData.getCurrentMBO() + ": (S>"

+ statusData.getSentByteCount() + ":"

+ statusData.getSentRowCount() + " R<"

+ statusData.getReceivedByteCount() + ":"

+ statusData.getReceivedRowCount() + ")";

break;

case SyncStatusState.APPLICATION_SYNC_CANCELLED:

infoMessage = "SYNC CANCELED [" + interval + "]";

break;

case SyncStatusState.APPLICATION_DATA_DOWNLOADING_DONE:

infoMessage = "DATA DOWNLOADING DONE [" + interval + "]";

break;

case SyncStatusState.SYNC_DONE:

infoMessage = "DONE [" + interval + "]";

break;

default:

infoMessage = "STATE" + syncState + "[" + interval + "]";

break;

}

Log.d(TAG, infoMessage);

return false;

}

}

Add comment
10|10000 characters needed characters exceeded

  • Follow
  • Get RSS Feed

1 Answer

  • Jun 05, 2012 at 05:35 PM

    You have not set the SynchronizationProfile to the MBOPackageDB.

    Add comment
    10|10000 characters needed characters exceeded