This document will provide you with detailed documentation about creating Mobeelizer client application on Java platform.
In this document we assumes that you are familiar with:
- JAVA language
- Key concepts of Mobeelizer platform (see)
To work with Mobeelizer cloud first you have to add Mobeelizer SDK to your application.
If you have use Maven to build your application simply add new dependency:
Otherwise download Mobeelizer SDK and its dependencies (commons-logging.commons-logging 1.1.1, org.apache.httpcomponents.httpcore 4.2.1, org.apache.httpcomponents.httpclient 4.2.1, org.apache.httpcomponents.httpmime 4.2.1, org.json.json 20090211, org.slf4j.slf4j-api 1.6.4) and include them into your application classpath.
Next, download XML file of your application created in App Designer and put it in your application directory.
Please see create model classes for more information.
To initialize Mobeelizer SDK you have to have the instance of MobeelizerConfiguration class. This configuration is pass to the Mobeelizer object.
Configuration fields are:
Stream with the application definition.
Name of the device category. See this document for more explanation.
Unique identifier of your application's deployment.
Package of your model classes.
There are two possible development modes:
By default TEST is set.
Name of the instance to connect to. By default it is named base on mode, accordingly "test" and "production".
Login of the administration user.
Password of the administration user.
User management API lets to manage your instance's users. There are methods for CRUD operations on users, listing groups, listing users and authenticate users.
There are two methods to sync your application data with Mobeelizer Cloud - syncAll(MobeelizerSyncCallback callback) and sync(Iterable entities, Iterable files, MobeelizerSyncCallback callback). The first one is used to overwrite your application data with data from cloud. It has to be also used as initial synchronization. The second one is differential synchronization.
The 'entities' param is the list of model objects (instances of model classes) that with will be sent to the cloud. It contains entities that have been added, updated and deleted. To delete entity its "deleted" field must be set to true.
The 'files' param is the list of MobeelizerFile object represented files that will be sent to the cloud.
The 'callback' is the object that will receive notification when the synchronization has finished. It will receive new entities and files from the cloud.
The example sync implementation is presented below:
Get Conflict History
There is dedicated method in Mobeelizer to get entity conflict history - getConflictHistory(model, guid, callback).
The model parameter is String type and it is name of the conflicted entity model. Second parameter - guid - is unique guid value of the entity. The 'callback' is the object that will receive notification when getting history finished. It will receive list of entity versions.
The example is presented below:
To learn about Push notification see Push notifications key concept page.
Registering to receive push notifications
If you want client application to be able to receive push notifications you must create web service and register the URL that will be exposed it.
The URL should be registered in MobeelizerConfiguration object.
Sending push notifications
To send Push notification call one of methods on Mobeelizer object:
- sendRemoteNotification(Map notification)
- sendRemoteNotificationToDevice(Map notification, String device)
- sendRemoteNotificationToUsers(Map notification, List users)
- sendRemoteNotificationToUsersOnDevice(Map notification, List users, String device)
- sendRemoteNotificationToGroup(Map notification, String group)
- sendRemoteNotificationToGroupOnDevice(Map notification, String group, String device)