public class Countly extends CountlyLifecycle
#init(Application, Config).CountlyLifecycle.stop(boolean) if needed.session() to get a Session instance.login(String) & logout() when user logs in & logs out.| Modifier and Type | Field and Description |
|---|---|
protected static Countly |
cly |
static Device |
device
A class responsible for storage of device information sent to Countly server.
|
protected SDK |
sdk |
Lctx, sdkInterface| Modifier | Constructor and Description |
|---|---|
protected |
Countly(SDK sdk,
CtxImpl ctx) |
| Modifier and Type | Method and Description |
|---|---|
static Usage |
api()
Alternative to
getSession() & session() method for accessing Countly SDK API. |
Usage |
changeDeviceIdWithMerge(java.lang.String id)
Change device id with merging profiles on server, just set device id to new one.
|
Usage |
changeDeviceIdWithoutMerge(java.lang.String id)
Change device id without merging profiles on server, just set device id to new one.
|
java.lang.String |
getDeviceId()
This method returns the Device ID that is currently used by the SDK.
|
static Session |
getSession()
Deprecated.
This method deprecated, please
use |
Usage |
login(java.lang.String id)
Login function to set device (user) id on Countly server to the string specified here.
|
Usage |
logout()
Logout function to make current user anonymous (that is with random id according to
ConfigCore.deviceIdStrategy and such). |
static void |
onConsent(Config.Feature... features)
Consent function which enables corresponding features of SDK with respect to GDPR.
|
static void |
onConsentRemoval(Config.Feature... features)
Consent function which disables corresponding features of SDK with respect to GDPR.
|
Usage |
resetDeviceId(java.lang.String id) |
static Session |
session()
|
init, isInitialized, isTracking, stopaddCrashReport, addCrashReport, addLocation, addParam, event, session, timedEvent, user, view, viewpublic static Device device
Device.setAppVersion(String) prior to
initializing the SDK to make sure data is reported.protected static Countly cly
protected SDK sdk
public static Session session()
Session if any or creates new Session instance.
NOTE: Session instances can expire, for example when ConfigCore.DID changes.
Session also holds application context.
So either do not store Session instances in any static variables and use this method or getSession() every time you need it,
or check Session.isActive() before using it.Session instancepublic static Session getSession()
use session() instead.
public static Usage api()
getSession() & session() method for accessing Countly SDK API.Usage instancepublic Usage login(java.lang.String id)
UsageConfigCore.autoSessionsTracking is on, acquires device id.id - new user / device id string, cannot be emptypublic Usage logout()
UsageConfigCore.deviceIdStrategy and such). Obviously makes sense only after a call to Usage.login(String),
so it throws error or does nothing (depending on ConfigCore.testMode) if current id wasn't set using Usage.login(String).
Closes current session.public java.lang.String getDeviceId()
Usagepublic Usage resetDeviceId(java.lang.String id)
public Usage changeDeviceIdWithMerge(java.lang.String id)
Usageid - new user / device id string, cannot be emptypublic Usage changeDeviceIdWithoutMerge(java.lang.String id)
Usageid - new user / device id string, cannot be emptypublic static void onConsent(Config.Feature... features)
Config.setRequiresConsent(boolean) is true.features - features to turn onpublic static void onConsentRemoval(Config.Feature... features)
Config.setRequiresConsent(boolean) is true.features - features to turn offf