This section provides information on initialisation of the SDK.
To initiate the Capillary SDK,
-
Create an instance of the SDK for each application. This API needs to be called in the
onCreate()
of the application class with theHydraConfig
. You can use this instance in your code to interact with the SDK. -
fun instanceWithConfig( context: Context, config: HydraConfig ): HydraAPI
public HydraAPI instanceWithConfig(Context context, HydraConfig config) { // Function body goes here }
-
Provide configuration in the SDK using
HydraConfig
. The SDK accepts several parameters. The parameter accountId is mandatory. If accountID is not provided, the SDK throws an exception. All other parameters are optional.var accountId: String, var baseURL: String?, var sslPublicKey: String?, var country: String?, var city: String?, var countryCode: String?, var captureViewPortDetails: Boolean, var isDisableAppLaunchedEvent: Boolean, var debugLevel: Int var fcmConfig:FcmConfig = defaultFcmConfig(), val notificationConfig: NotificationConfig? = null
String accountId; String baseURL; String sslPublicKey; String country; String city; String countryCode; boolean captureViewPortDetails; boolean isDisableAppLaunchedEvent; int debugLevel; FcmConfig fcmConfig = defaultFcmConfig();
-
Add the SDK initialization block in the
onCreate
callback of your application class as shown below:val hydraConfig = HydraConfig.Builder( applicationContext, accountId = "PARTNER_ACCOUNT_ID" ) .debugLevel(LogType.VERBOSE) .captureViewPortDetails(true) .country("India") .city("Pune") .countryCode("91") .baseURL("PARTNER_HYDRA_URL") .sslPublicKey("PARTNER_SSL_PUBLIC_KEY_FOR_HYDRA_URL") .build()
HydraConfig hydraConfig = new HydraConfig.Builder(applicationContext) .setAccountId("PARTNER_ACCOUNT_ID") .setDebugLevel(LogType.VERBOSE) .setCaptureViewPortDetails(true) .setCountry("India") .setCity("Pune") .setCountryCode("91") .setBaseURL("PARTNER_HYDRA_URL") .setSslPublicKey("PARTNER_SSL_PUBLIC_KEY_FOR_HYDRA_URL") .build();
Parameter Type Description Mandatory/Optional accountId String Account ID of the partner Mandatory .debugLevel LogType Logging Config i.e. OFF(-1), INFO(0), DEBUG(1), VERBOSE(2) Optional .captureViewPortDetails Boolean Capture ViewPort information Optional .country String Country name Optional .city String City name Optional .countryCode String Country code value Optional .baseURL String Base URL of region Optional .sslPublicKey String Valid SSL Public Key of URL Optional .fcmConfig FcmConfig object Firebase Configuration Optional (If not using Firebase SDK) .notificationConfig NotificationConfig object Notification Configuration Optional (If not using Firebase SDK) -
Create an instance of the
HydraAPI
withHydraConfig
. Use the below functional call:
HydraAPI.instanceWithConfig(applicationContext, hydraConfig)
Parameter Type Description Optional/Mandatory applicationContext Context Application context Mandatory hydraConfig HydraConfig HydraConfig object Mandatory