Monterosa / Interaction Cloud (M/IC) was previously known as LViS. As such, you will find API documentation using the term.
The Android lib allows Android developers to connect natively to the platform.
Add to the /build.gradle
allprojects {repositories {maven {url "s3://fankit.android.s3.amazonaws.com"credentials(AwsCredentials) {accessKey "AKIAILV2UEEPQRSY726A"secretKey "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"}}}}
Add to the app/build.gradle. Please see changelog for latest LViS versions.
implementation 'co.monterosa.fankit:lvis:23.0.1'
Add Proguard rules: https://gitlab.monterosa.co.uk/mobile/enmasse_android/blob/master/proguard-rules.pro _[_https://gitlab.monterosa.co.uk/mobile/lvis_android/blob/master/proguard-rules.pro](https://gitlab.monterosa.co.uk/mobile/lvis_android/blob/master/proguard-rules.pro)
The LViS library internally depends on Enmasse library and its dependencies and all of them are fetched automatically when you add LViS library to client project.
​Groovy​
implementation 'co.monterosa.fankit:enmasse:23.0.0'
There are 4 basic blocks that you need to work with:
LViS - is an entry point to work with LViS lib
Project - is an entity that represents an 'LViS Project'
Event - is an entity that represents an 'LViS Event'
Elements - are entities that represent 'LViS Elements'
You can override default TRUE values if needed.
void setWssSupport(boolean useWss);void setReloadEventsHistorySupport(boolean reload);
LViS needs to store its values internally. So you need to set a path to your internal or external storage:
void setCacheDir(String cacheDirPath);
LViS needs to be initialized with projectUuid and host
void setProject(String host, String projectUuid);
It's possible to load App Setup before connecting to LViS
void loadSettings(new ResultCallback() {@Overridepublic void onSuccess(Object result) {}@Overridepublic void onFailed(String reason) {}});
To open LViS and subscribe to its changes:
void open(new LViSObserver() {@Overridepublic void onInit(boolean reinit) {Project project = LViS.getInstance().getProject();}@Overridepublic void onScheduleReinit(long backoffMillis) {}@Overridepublic void onEventPublished(Event event) {}@Overridepublic void onSettingsChanged() {}});
To subscribe to an event:
void subscribe(event, new ResultCallback() {@Overridepublic void onSuccess(){}@Overridepublic void onFailed(String reason) {}});
After you've subscribed to an event you can get all event elements:
List<Element> allElements = event.getHistory();
And you can listen to an event's changes:
event.registerCallback(new Event.Callback() {@Overridepublic void onUpdated() {}@Overridepublic void onStateChanged(Event.State state) {}@Overridepublic void onElementPublished(Element element) {}@Overridepublic void onElementRevoked(Element element) {}});
You can listen to each element's changes. For example, to listen to a Regular poll's changes:
if (element instanceof RegularPoll){RegularPoll regularPoll = (RegularPoll) element;regularPoll.registerCallback(new RegularPoll.Callback() {@Overridepublic void onStateChanged(RegularPoll.State state) {}@Overridepublic void onResults() {}@Overridepublic void onVote() {}});}
To unsubscribe from an event:
void unsubscribe(event);
To log in with your userId and signature
User.login(String userId, long timestamp, String signature, ResultCallback resultCallback)
After you've done with LViS you need to close it to clean all resources:
void close()
If you need to manage logs:
Log.enableTags(String[] tags) //Supported tags are {LViS.TAG, Enmasse.TAG, TransportApi.TAG}Log.registerCallback(Callback callback)
​https://gitlab.monterosa.co.uk/mobile/lvis_android/tags​