cancel
Showing results for 
Search instead for 
Did you mean: 

How to unregister remote DB in MobiLink from the device side?

Vlad
Product and Topic Expert
Product and Topic Expert
0 Kudos
2,518

Hello everybody,

I know that the user (or remote DB) registration process can be controlled by the administrator, by the -zu parameter, or custom scripts. When I use the code below to play with ML, my client database is always destroyed:

ConfigNonPersistent config = DatabaseManager.createConfigurationNonPersistent("testDB.ulj");


But, after some time I found out that ml_database has a plenty of "remote IDs" (remote databases that do not exist anymore). I tried to search for any API method of UltraLiteJ to unregister my database, but could not find anything.

Could you please help me with this question? Or there is not such concept in MobiLink as "register"/"unregister", and everything should be maintained by the administrator and e.g. ml_delete_remote_id/ml_delete_sync_state. I know that my example is very artificial, but I use it as the playground, and I want to do the automatic registration and unsubscription of the application from the code.

Thank you in advance,
Vlad

Accepted Solutions (1)

Accepted Solutions (1)

jeff_albion
Advisor
Advisor

Hi Vlad,

What you're looking at is the tracking mechanism used within MobiLink to keep track of unique remotes in the MobiLink system. It's not really a 'register'/'unregister' mechanism since remotes are generated without a remote ID by default. Unless the ml_remote_id database option is set before the first synchronization, MobiLink will generate a new remote ID for each newly initialized database and set it in the remote database once it first synchronizes.

What you really want to do is set up your register/unregister mechanism to register a MobiLink user for user authentication to the MobiLink server and then manage that authentication mechanism.


If you want to remove the unused remote IDs on the consolidated server, then yes, you will have to use 'ml_delete_sync_state'.

Vlad
Product and Topic Expert
Product and Topic Expert
0 Kudos

Hello Jeff,

Thank you for the answer. I know what you mentioned. The idea that I see is to create some fake remote table with the "upload_only" attribute. When the user sets a field meaning that he wants to unregister, the MobiLink server during the synchronization will invoke the stored procedure ml_delete_sync_state, instead of upserting the record.

This approach looks clumsy probably, but it is the only possible way to automate the process. RemoteID and UserName can be taken from the connection without asking the device.

What do you think about this "workaround"/"solution"?

Kind regards,
Vlad

jeff_albion
Advisor
Advisor
0 Kudos

You can certainly do this if this is the goal you're trying to acheive to only see 'active' remote database IDs.

Personally, I would try to avoid confusing the idea of 'registering a remote ID' (which happens for any remote that can attempt to synchronize against the MobiLink server) vs. 'logging in with a authenticated MobiLink user' (which only happens for approved users by an administrator/script).

If I was using MobiLink usernames to keep track of active remotes, I could instead look at my (registered) MobiLink user information (ml_user), rather than at the remote ID information (ml_database).

Vlad
Product and Topic Expert
Product and Topic Expert
0 Kudos

I understand that the remote id is a bad idea to track whether the current remote database is allowed to retrieve the data, or not. I just couldn't decide if I should really clean all unused remote databases from the ml_database, when I definitely sure that this remote id will not appear again during the sync. E.g. The user has decided to do the device reset, or uninstalled the application from one of devices being used, or as in my sample project, where the non-persistent DB is used. If I have an option to unregister the user by his name, then I have a chance that all valid remote DBs will lose their sync states.

Answers (0)