Interface SdkBuilder
A builder class you can use to instantiate your instance of the SDK.
public interface SdkBuilder
All Known Implementing Classes: ← : JustTrackSdkBuilder
Methods
build
@NonNull
JustTrackSdk build()
Build a new instance of the SDK. You should not use the builder after calling this method.
Returns
A fresh instance of the SDK.
Throws
Name | Description |
---|---|
IllegalArgumentException | Thrown if the SDK could not be build because a parameter |
setAttributionRetryDelaySeconds
@NonNull
SdkBuilder setAttributionRetryDelaySeconds(long attributionRetryDelaySeconds)
Specify the number of seconds the SDK waits between tries to get an attribution after a network failure.
Parameters
Name | Description |
---|---|
attributionRetryDelaySeconds | The number of seconds until another try is made to fetch an attribution. |
Returns
The builder so you can chain methods if you want.
setAutomaticInAppPurchaseTracking
@NonNull
SdkBuilder setAutomaticInAppPurchaseTracking(boolean enabled)
The justtrack SDK can automatically track in-app product and subscription purchases and forward them to the justtrack backend. It is enabled by default, but this method allows you to configure the automation for your needs.
Parameters
Name | Description |
---|---|
enabled | Set this to true to automatically forward in-app product and subscription purchases. |
Returns
The builder so you can chain methods if you want.
setEnableBroadcastReceiver
@NonNull
SdkBuilder setEnableBroadcastReceiver(boolean enabled)
Configure whether the SDK registers a BroadcastReceiver
to integrate
with other justtrack libraries. This is enabled by default, but you can disable it if you
know that registering such a receiver is not allowed (e.g., because your app is currently in the
background).
If a BroadcastReceiver
can not be registered by the SDK, an error will
be logged and the integration with other justtrack libraries is slightly degraded.
Parameters
Name | Description |
---|---|
enabled | True if the SDK should try to register a BroadcastReceiver . |
Returns
The builder so you can chain methods if you want.
setEnableFirebaseIntegration
@NonNull
SdkBuilder setEnableFirebaseIntegration(boolean enableFirebaseIntegration)
Specify whether we should automatically integrate with the Firebase SDK and send the Firebase app instance id of the user to the justtrack backend.
The integration is enabled by default if the Firebase SDK was detected in your app. You can however use this method to override the default behavior (although forcing the integration has a huge chance of not working, if we can't find the Firebase SDK, we will most likely not be able to talk to it, either).
You can disable the Firebase integration if you are already sending the Firebase app instance
id to the justtrack SDK by hand (see setFirebaseAppInstanceId(String)
or
JustTrackSdk.setFirebaseAppInstanceId(String)
).
Parameters
Name | Description |
---|---|
enableFirebaseIntegration | Whether we should send the Firebase app instance id |
Returns
The builder so you can chain methods if you want.
setEnableIronSourceIntegration
@NonNull
SdkBuilder setEnableIronSourceIntegration(boolean enabled, @NonNull UserIdSource userIdSource)
Configure whether the SDK should integrate with IronSource and configure which user id it should
forward to IronSource after you call build()
. The SDK will also send an AppEvent
for each ad to the backend.
This method overrides the setting from setEnableIronSourceIntegration(boolean, String)
.
By default the integration is disabled.
Parameters
Name | Description |
---|---|
enabled | True if the SDK should integrate with IronSource. |
userIdSource | Configures whether we forward the justtrack user id or no user id at all. |
Returns
The builder so you can chain methods if you want.
setEnableIronSourceIntegration
@NonNull
SdkBuilder setEnableIronSourceIntegration(boolean enabled, @NonNull String customUserId)
Configure whether the SDK should integrate with IronSource and provide the userId you specified
after you call build()
. The SDK will also send an AppEvent
for each ad
impression to the backend.
This method overrides the setting from setEnableIronSourceIntegration(boolean, UserIdSource)
.
By default the integration is disabled.
Parameters
Name | Description |
---|---|
enabled | True if the SDK should integrate with IronSource. |
customUserId | The user id to forward to IronSource. |
Returns
The builder so you can chain methods if you want.
setFirebaseAppInstanceId
@NonNull
SdkBuilder setFirebaseAppInstanceId(@NonNull String firebaseAppInstanceId) throws InvalidFieldException
Forward the Firebase app instance id (how to obtain one) to the justtrack backend upon SDK init.
You don't need to call this method if you rely on the automatic integration (see setEnableFirebaseIntegration(boolean)
)
or later publish the Firebase app instance id by hand (JustTrackSdk.setFirebaseAppInstanceId(String)
).
The Firebase app instance id must be between 8 and 256 characters and consist only of printable ASCII characters (U+0020 to U+007E).
Parameters
Name | Description |
---|---|
firebaseAppInstanceId | The id to forward. |
Returns
The builder so you can chain methods if you want.
Throws
Name | Description |
---|---|
InvalidFieldException | If the Firebase app instance id was set to an invalid value. |
setInactivityTimeFrame
@NonNull
SdkBuilder setInactivityTimeFrame(long inactivityTimeFrameHours)
Specify the time frame after which a user is considered to be inactive. Default: 48h.
An inactive user did not open the app for this time frame and will check for a new attribution on the next app open. Thus, by default a user is inactive if they don't open the app at least every other day.
Parameters
Name | Description |
---|---|
inactivityTimeFrameHours | After how many hours will a user be inactive. |
Returns
The builder so you can chain methods if you want.
setInstallUncaughtExceptionHandler
@NonNull
SdkBuilder setInstallUncaughtExceptionHandler(boolean installHandler)
Specify whether the justtrack SDK should install a handler for uncaught exceptions. The handler installed by the justtrack SDK will forward any uncaught exception to the previous default uncaught exception handler.
This is enabled by default. If you disable this, you can install the same handler
manually by calling JustTrackSdk.installUncaughtExceptionHandler()
.
Parameters
Name | Description |
---|---|
installHandler | Whether we should install the justtrack uncaught exception handler. |
Returns
The builder so you can chain methods if you want.
setLogger
@NonNull
SdkBuilder setLogger(@NonNull Logger logger)
Set the logger the SDK will use. If you do not call this method, a default logger implementation will be used.
Parameters
Name | Description |
---|---|
logger | The logger to use. |
Returns
The builder so you can chain methods if you want.
setManualStart
SdkBuilder setManualStart(boolean isManual)
Dictates the nature of the start method call. If set to true then the start method will have to be called by app developers after justtrack SDK initialization. If set to false, which is the default value, then the start method will be automatically called by justtrack SDK after initialization.
Parameters
Name | Description |
---|---|
isManual | whether the sdk should start manually or not |
Returns
The builder so you can chain methods if you want.
setPlatformType
@NonNull
SdkBuilder setPlatformType(PlatformType platformType)
Specify which platform the SDK is running on. By default the platformType is set to Android.
Parameters
Name | Description |
---|---|
platformType | ANDROID, UNITY, REACT_NATIVE |
Returns
The builder so you can chain methods if you want.
setReAttributionTimeFrame
@NonNull
SdkBuilder setReAttributionTimeFrame(long reAttributionTimeFrameDays)
Specify the time frame after which a user is considered to be eligible for re-attribution. Default: 14 days.
A user eligible for re-attribution will fetch an attribution on the next app open. Thus, every active user will by default check every two weeks for a new attribution.
Parameters
Name | Description |
---|---|
reAttributionTimeFrameDays | After how many days will a user be eligible for re-attribution. |
Returns
The builder so you can chain methods if you want.
setReFetchReAttributionDelaySeconds
@NonNull
SdkBuilder setReFetchReAttributionDelaySeconds(long reFetchReAttributionDelaySeconds)
Specify the number of seconds until the SDK fetches the attribution again after a re-attribution opportunity was detected.
Set to a negative number to deactivate fetching the attribution again.
Parameters
Name | Description |
---|---|
reFetchReAttributionDelaySeconds | The number of seconds until the attribution is fetched a second time. |
Returns
The builder so you can chain methods if you want.
setTrackingId
@NonNull
SdkBuilder setTrackingId(@Nullable String trackingId, @NonNull String trackingProvider) throws InvalidFieldException
Set the tracking id the SDK will send to the backend.
The tracking id and provider must be shorter than 4096 characters and consist only of printable ASCII characters (U+0020 to U+007E).
Parameters
Name | Description |
---|---|
trackingId | The tracking id the SDK will send to the backend. |
trackingProvider | The tracking provider which supplied the trackingId. |
Returns
The builder so you can chain methods if you want.
Throws
Name | Description |
---|---|
InvalidFieldException | If the tracking id or tracking provider were set to invalid values. |
setUrlShortener
@Deprecated
@NonNull SdkBuilder setUrlShortener(@NonNull UrlShortener urlShortener)
Deprecated.
Set the URL shortener the SDK will use. If you do not call this method, a default implementation (which does not shorten URLs) will be used.
Parameters
Name | Description |
---|---|
urlShortener | The UrlShortener to use. |
Returns
The builder so you can chain methods if you want.
setUserId
@NonNull
SdkBuilder setUserId(@NonNull String userId) throws InvalidFieldException
Forward a user id to the justtrack backend upon SDK init.
The user id must be shorter than 4096 characters and consist only of printable ASCII characters (U+0020 to U+007E).
Parameters
Name | Description |
---|---|
userId | The user id to forward. |
Returns
The builder so you can chain methods if you want.
Throws
Name | Description |
---|---|
InvalidFieldException | If the user id was set to an invalid value. |