Hello,
I have a question regarding some synchronisation issues I ran into when creating a small application using SUP.
I am using asynchronous synchronisation of the sampledb database (located at localhost:5500) and the Android application by using the Java Object API.
In other words, I have set everything up so that the application automatically reflects manual changes in the sampledb database.
So far, so good.
Next, I tested the offline capabilities of my application. I stopped the sampledb service and then made some changes to the data on the Android device, to be more specific, I added one new entry (= 1 new record) and updated another entry (= 1 updated record). However, when I restart the sampledb service, the application doesn't automatically sync with the (now available) database. Even when I manually synchronise by calling the GeneratedDB.java "synchronize" method, I don't get the desired results (changed in the database) and after a while a timeout occurs.
However, when I update both entries again, and manually synchronise, then it does reflect the changes in the database.
Also, when I shut down the application and restart it, the synchronisation works as well.
My manual synchronisation method (NextGenDB is the generated database .java file):
GenericList sgs = new GenericList();
sgs.add(NextGenDB.getSynchronizationGroup("default"));
NextGenDB.beginSynchronize(sgs, "");
My initialisation code:
Application app = Application.getInstance();
app.setApplicationIdentifier("NextGen");
app.setApplicationContext(this);
NextGenDB.setApplication(app);
ConnectionProperties connProps = app.getConnectionProperties();
connProps.setServerName("<server IP>");
connProps.setPortNumber(5001);
connProps.setLoginCredentials(new LoginCredentials("supuser",
"password"));
NextGenDB.getSynchronizationProfile().setServerName(
connProps.getServerName());
NextGenDB.registerCallbackHandler(new CustomCallbackHandler());
if (app.getRegistrationStatus() != RegistrationStatus.REGISTERED) {
app.registerApplication(300);
} else {
app.startConnection(60);
}
ConnectionProfile connProfile = NextGenDB.getConnectionProfile();
connProfile.setEncryptionKey("secret");
connProfile.setCacheSize(524288);
connProfile.save();
if (!NextGenDB.isSynchronized("default")) {
NextGenDB.synchronize();
TicketSynchronizationParameters syncParams = Ticket
.getSynchronizationParameters();
syncParams.setOpenedBy(NextGenDB.getSyncUsername());
syncParams.save();
NextGenDB.synchronize();
}
SynchronizationGroup sg = NextGenDB
.getSynchronizationGroup("default");
if (!sg.getEnableSIS()) {
sg.setEnableSIS(true);
sg.save();
NextGenDB.synchronize("default");
}
NextGenDB.enableChangeLog();
adapter = new TicketListViewAdapter(this, R.id.listView1,
getTickets());
Can anyone help me with this?
Thanks in advance,
Nicolas