Skip to content

Initialization of the IOMb Library Android

To use the IOMb Library Android for census measurement, the measurement system IOMb (BASE) must be used. The following describes how an IOMb session can be configured, initialized and used for measurement.

note

The parameters required for this, such as site ID and base URL, are assigned individually by INFOnline for each site or explained in the following and are only exemplary in the following presentation.

Initialization of an IOMb Session:

Creation of an IOMBSetup object (incl. site ID and base URL) as well as initialization of the BASE/IOMb session in an "IOMB_Session" object of type Measurement

Kotlin:

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
import de.infonline.lib.iomb.IOMB
import de.infonline.lib.iomb.measurements.Measurement
import de.infonline.lib.iomb.measurements.iomb.IOMBSetup


val setup = IOMBSetup(
               baseUrl = "https://data-ef4e2c0163.example.com")
               offerIdentifier = "Site ID",

IOMB.create(setup).subscribe { it ->
            IOMB_SESSION = it
        }

companion object {
   lateinit var IOMB_SESSION: Measurement
}        

Java:

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
import de.infonline.lib.iomb.IOMB
import de.infonline.lib.iomb.measurements.Measurement
import de.infonline.lib.iomb.measurements.iomb.IOMBSetup

String baseUrl = "https://data-ef4e2c0163.example.com";
String offerIdentifier = "Site ID";
String hybridIdentifier = null;
String customerData = null;

IOMBSetup setup = new IOMBSetup(baseUrl, offerIdentifier, hybridIdentifier, customerData);

IOMB.create(setup).subscribe(new SingleObserver<Measurement>() {
   @Override
   public void onSubscribe(@NonNull Disposable d) {
   }

   @Override
   public void onSuccess(@NonNull Measurement measurement) {
         IOMB_SESSION = measurement;
   }

   @Override
   public void onError(@NonNull Throwable e) {
   }
});

Site ID and https://data-ef4e2c0163.example.com are examples, you will get your site specific values from INFOnline. If you operate the service platform as self-hosting, the following chapter describes how the baseUrl is structured.

In the above example, the IOMb session is generated asynchronously.

Alternatively, this can be done synchronously ("blocking"):

Kotlin:

1
IOMB_SESSION = IOMB.createBlocking(setup)

Java:

1
IOMB_SESSION = IOMB.createBlocking(setup);


Event logging:

Events are logged through the IOMBSession. They can be logged in the activities of the app, e.g. calling a view:

Kotlin:

1
2
val event = IOLViewEvent(type = IOLViewEvent.IOLViewEventType.Appeared, category = "MainScreen")
IOMB_SESSION.logEvent(event)

Java:

1
2
3
4
IOLViewEvent.IOLViewEventType type = IOLViewEvent.IOLViewEventType.Appeared;
String category = "MainScreen";

IOMB_SESSION.logEvent(new IOLViewEvent(type, category));


Last update: May 10, 2023