Android - Configuration
The SDK is configurable at the start time. You can set a large set of options to customize how the SDK works
Init Obsly Engine
Initialize the sdk using ObslyOptions, this parameter is optional, if OblsyOptions is null, default options will be applied. (all modules activated)
public static void init(final Application app, ObslyOptions options, String apiKey, URL instanceUrl)
Parameter |
Description |
---|---|
final Application app |
Current application |
Obslyoptions options |
Obsly options {@link ObslyOptions }. If null, default options (all disabled) is used |
String apiKeys |
Obsly's Api key |
URL instanceUrl |
Object of type "URL" |
Example
Obsly instance = new Obsly();
Application myApp = new MyApplication();
ObslyOptions options = new ObslyOptions();
String apiKey = "API_KEY";
URL instanceUrl = new URL("https://www.example.com/instance");
instance.init(myApp, options, apiKey, instanceUrl);
Start Engine
This methods starts Obsly engine, all the modules configured start to operate, a default Session will be created.
public static void start()
Example
start();
Start New Session
Create a new session, using random identifier, all the new events belong to this session, this methods it's optional.
public static void startSession()
You can also customize the name of the session.
public static void startSession(String sessionName)
Parameter |
Description |
---|---|
String sessionName |
Session name |
Example
startSession();
startSession("newSession"); // Start session with custom name
End Session
End current session.
public static static void endSession()
Example
endSession();
Set Request Blacklist
Allows to set a list of hosts that be blacklisted, the http request to this hosts will not be tracked.
public static void setRequestBlacklist(List<String> hostList)
Parameter |
Description |
---|---|
List<String> hostList |
A list of hosts |
Example
List<String> hostList = new ArrayList<>();
hostList.add("example.com");
hostList.add("google.com");
....
setRequestBlacklist(hostList);
Set Properties
Set properties using ObslyProperties
public static void setProperty(ObslyProperties property, String value)
Parameter |
Description |
---|---|
ObslyProperties property |
Property key |
String value |
The value of propery |
Example
ObslyProperties properties = new ObslyProperties();
setProperty(properties.RELEASE, "1.1.0");
Get ObslyUUID
Returns de unique installation identifier for this installation, this number is unique for each installation of the Obsly sdk.
public static String getObslyUUID()
Example
String uuid = getObslyUUID();
Get Options
Expliación
public static ObslyOptions getOptions()
Example
ObslyOptions options = getOptions();
Add tags
Add array of customs tag to the current session
public static void addTags(@NonNull String category,HashMap<String, Object> tagsKeysValues)
Parameter |
Description |
---|---|
@NonNull String category |
Category for tags |
HashMap<String, Object> tagsKeysValues |
HashMap with key/values tags |
Example
HashMap<String, Object> tagsKeysValues = new HashMap<>();
tagsKeysValues.put("key1", "value1");
tagsKeysValues.put("key2", 42);
addTags("category", tagsKeysValues);
Uppdate Options
You can update de Options anytime to change Obsly behaviour. Review all the possible options in ObslyOptions
public static void updateOptions(ObslyOptions newOptions)
Parameter |
Description |
---|---|
ObslyOptions newOptions |
Object of type "ObslyOptions" |
Example
ObslyOptions newOptions = new ObslyOptions();
updateOptions(newOptions);