Skip to main content

Config

Initialization

You can initialize the SDK by specifying metadata in the AndroidManifest.xml

<meta-data android:name="snabble_app_id" android:value="YOUR_APP_ID" />  
<meta-data android:name="snabble_secret" android:value="YOUR_SECRET" />

You also can initialize the SDK programmatically by specifying in the AndroidManifest.xml:

<meta-data android:name="snabble_auto_initialization_disabled" android:value="true" />  

And then initialize the SDK via code.

val config = Config(  
appId = YOUR_APP_ID,
secret = YOUR_SECRET,
)

Snabble.setup(application, config)

Available parameters

ParameterTypeDefault ValueDescription
appIdStringnullThe project identifier, which is used in the communication with the backend.
secretStringnullThe secret needed for Totp token generation.
endpointBaseUrlStringhttps://api.snabble.ioThe endpoint url of the snabble backend. For example "https://api.snabble.io" for the Production environment.
bundledMetadataAssetPathStringnullRelative path from the assets folder which points to a bundled file which contains the metadata.
This file gets initially used to initialize the sdk before network requests are made, or be able to use the sdk in the case of no network connection. Optional. If no file is specified every time the sdk is initialized we wait for a network response from the backend. It is HIGHLY recommended to provide bundled metadata to allow the SDK to function without having a network connection.
bundledMetadataRawResIdString0Resource id of the raw file which contains the metadata.
This file gets initially used to initialize the sdk before network requests are made, or be able to use the sdk in the case of no network connection. Optional. If no file is specified every time the sdk is initialized we wait for a network response from the backend. It is HIGHLY recommended to provide bundled metadata to allow the SDK to function without having a network connection.
generateSearchIndexBooleanfalseIf set to true, creates an full text index to support searching in the product database using findByName or searchByName. Note that this increases setup time of the ProductDatabase, and it may not be immediately available offline.
maxProductDatabaseAgeLong1 hourThe time that the database is allowed to be out of date. After the specified time in milliseconds the database only uses online requests for asynchronous requests. Successfully calling [ProductDatabase.update] resets the timer. The time is specified in milliseconds. The default value is 1 hour.
maxShoppingCartAgeLong4 hoursThe time that the shopping cart is allowed to be alive after the last modification. The time is specified in milliseconds. The default value is 4 hours.
disableCertificatePinningBooleanfalseIf set to true, disables certificate pinning.
initialSQLStringListempty listSQL queries that will get executed in order on the product database
vibrateToConfirmCartFilledBooleanfalseVibrate while adding a product to the cart, by default false.
loadActiveShopsBooleanfalseSet to true, to load shops that are marked as pre launch and are not part of the original metadata in the backend (for example for testing shops in production before a go-live).
checkInRadiusFloat500 metersThe radius in which the CheckInManager tries to check in a shop. In meters.
checkOutRadiusFloat1000 metersThe radius in which the CheckInManager tries to stay in a shop, if already in it. If outside of this radius and the lastSeenThreshold, you will be checked out.
lastSeenThresholdLong15 minutesThe time in milliseconds which we keep you checked in at a shop. The timer will be refreshed while you are still inside the shop and only begins to run if you are not inside the checkOutRadius anymore.
networkInterceptorInterceptornullNetwork interceptor used for all calls made by the SDK.
manualProductDatabaseUpdatesBooleanfalseSet to true if you want to control when the product database gets updated, otherwise the product database gets updated when checking in and if checked in when the app resumes.