Links

Android Lib Overview

We are working on a new SDK that will replace this Javascript library during early 2023. Please check the section Building your own Experience and Embedding Experiences using the SDK sections to find out more.
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 project

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'

Dependencies

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.
implementation 'co.monterosa.fankit:enmasse:23.0.0'

LViS library structure

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'

How to use

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() {
@Override
public void onSuccess(Object result) {
}
@Override
public void onFailed(String reason) {
}
});
To open LViS and subscribe to its changes:
void open(new LViSObserver() {
@Override
public void onInit(boolean reinit) {
Project project = LViS.getInstance().getProject();
}
@Override
public void onScheduleReinit(long backoffMillis) {
}
@Override
public void onEventPublished(Event event) {
}
@Override
public void onSettingsChanged() {
}
});
To subscribe to an event:
void subscribe(event, new ResultCallback() {
@Override
public void onSuccess(){}
@Override
public 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() {
@Override
public void onUpdated() {
}
@Override
public void onStateChanged(Event.State state) {
}
@Override
public void onElementPublished(Element element) {
}
@Override
public 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() {
@Override
public void onStateChanged(RegularPoll.State state) {
}
@Override
public void onResults() {
}
@Override
public 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)

Changelog