Android SDK

This page will guide you through the integration of our Android SDK into your app.


To check the latest version and all the previous once of the SDK, you can check this page.

What's new in this page:

Since v3.1.1

Account Set-Up and retrieving your API Key

Before we can get started with implementing the SDK, you should retrieve your API Key for your integration from the BitLabs Dashboard. If you haven't created an account yet, you can do so here and follow the instructions for the dashboard starting with Sign up & Set up.

App-level build.gradle file

Add the following code above the dependencies section of your app-level build.gradle file:

repositories {
   maven {
       url ''
repositories {

Adding Dependencies

dependencies {
   // other dependencies
   implementation 'com.github.BitBurst-GmbH.bitlabs-android-library:core:3.1.1'

   // other dependencies
dependencies {
   // other dependencies


   // other dependencies

Allowing your App to access the internet

If your app doesn't have this already, make sure to allow access to the internet.

//App Permissions
<uses-permission android:name="android.permission.INTERNET" />

Initialising the SDK

You must initialise the SDK before you can use it. You can do so with the following code.

BitLabs.init(<Context>, "YOUR-TOKEN", "YOUR-USER-ID");
BitLabs.INSTANCE.init(<Context>, "YOUR-TOKEN", "YOUR-USER-ID");

The <Context> is used to get the device Advertising Id to support BitLabs Offers. This is where you will need the API key from the dashboard, as you will need to replace "YOUR-TOKEN" with it. For "YOUR-USER-ID", you will need to dynamically insert the user id for each app user. Make sure the id used here is unique and that it does not change, as the user's profile will be stored under this id.


You can also hold the reference of BitLabs.INSTANCE in a global or local variable like this:

BitLabs bitLabs = BitLabs.INSTANCE

And now you can use the library as

bitLabs.init("YOUR-TOKEN", "YOUR-USER-ID");

Using the SDK

Show the Offer Wall to the user

Now it's time to use the BitLabs SDK so that your users can start taking surveys. Call the .launchOfferWall() function to open the Offer Wall/Direct Link. BitLabs will show up and the user will see qualifications or surveys.


The <Context> here can be the context of an Activity or of the Application.


That's it!

Theoretically, this is all you have to do. Anything below is optional but can improve the user experience.

Check For Surveys - Check if there's something to do for the user

You can use .checkSurveys(onResponseListener, onErrorListener) to check if a survey is available for the user. The onResponseListener callback will return true whenever there's a survey or a qualification question available for the user. Otherwise, it will return false.

  { hasSurveys -> Log.i(<TAG>, if (hasSurveys) "Found Surveys" else "No Surveys") },
  { e -> Log.e(<TAG>, "CheckSurveysErr: ${e.getMessage()}", e.getCause()) }
  hasSurveys -> Log.i(TAG, hasSurveys ? "Found Surveys" : "No Surveys"),
  e -> Log.e(TAG, "CheckSurveysErr: " + e.getMessage(), e.getCause())


In case an error has occured, the onError callback will be triggered instead of onResponse. So, make sure to implement it to know what kind of error occured.

Get Surveys Natively

You can use .getSurveys(onResponseListener, onErrorListener) to get available surveys for the user.

  { surveys -> Log.i(<TAG>, "Surveys: $surveys") },
  { exception -> Log.e(TAG, "GetSurveysErr: ${exception.getMessage()}", exception.getCause()) }
  surveys -> Log.i(<TAG>, "Surveys: " + surveys),
  exception -> Log.e(<TAG>, "GetSurveysErr: " + exception.getMessage(), exception.getCause())

The onResponseListener callback's parameter is a list of Surveys. A Survey has the following properties:

networkIdIntThe id of the Network this survey belongs to.
idIntThe id of the Survey.
cpiStringCPI of this survey in USD without any formatting applied.
valueStringCPI formatted according to your app settings. Can be shown to the user directly.
loiDoubleAssumed length of the survey in minutes.
remainingIntAmount of users that can still open the survey
detailsDetails(Category(name: String, IconUrl: String))The details of the category this Survey is classified in.
ratingIntDifficulty ranking of this survey. 1-5 (1 = hard, 5 = easy). Minimum value is 1, maximum value is 5.
linkStringThis link can be used as is to open the survey. All relevant details are inserted on the server.
missingQuestionsInt?The amount of questions that have to be answered before the survey is guaranteed to be openable by the user.
open()FunctionA function which opens the Offerwall.

Native Survey Widgets

You can use .getSurveyWidgets(<Context>, List<Survey>, WidgetType) to get a RecyclerView of survey widgets.

// If you have a layout, you can add the RecyclerView as shown below
// Note: `this` is the Activity context, and `surveys` is a List<Survey> variable.
layout.addView(bitlabs.getSurveyWidgets(this, surveys, WidgetType.SIMPLE))
// If you have a layout, you can add the RecyclerView as shown below
// Note: `this` is the Activity context, and `surveys` is a List<Survey> variable.
layout.addView(bitlabs.getSurveyWidgets(this, surveys));

The WidgetType can be one of three options:

Reward Listener - Client Side Callbacks

You can use .setOnRewardListener(onRewardListener) to set callback which receives the reward of the user and executes the behaviour you specify.

BitLabs.setOnRewardListener { payout -> Log.i(<TAG>, "Payout of: ${payout}") }
BitLabs.INSTANCE.setOnRewardListener(payout -> Log.i(<TAG>, "Reward payout: " + payout));

This callback is invoked when the user leaves the Offer Wall, and the payout is the total reward the user got since the Offer Wall is opened until it is closed.


At the moment, the reward in this callback is just that of the surveys. For offers, please use the server-to-server callback.


We highly recommend using server-to-server callbacks instead! Please do not use this in apps where the user can withdraw real currency, as it might be exploitable.
However, if your app stores user data locally and does not sync with a server, this would be an option to still use BitLabs to reward your users.

Tags - Set a list of Tags to receive in your callbacks

You can use .setTags(tags) to pass additional parameters to the SDK you would like to receive in your callback. The tags parameter is a HashMap<String, Object>.

val tags = mutableMapOf<String, Any>()
tags["my_tag"] = "new_user"
tags["is_premium"] = true
BitLabs.tags = tags
Map<String, Object> tags = new HashMap<>();
tags.put("my_tag", "new_user");
tags.put("is_premium", true);


Setting a new Map of Tags will replace the old ones.

Add a Tag - Add single tags to receive in your callbacks

Use addTag(key, value) if you want to append new tags to an already existent Map of tags which you already set earlier.

BitLabs.addTag("my_tag", "new_user")
BitLabs.addTag("is_premium", true)
BitLabs.INSTANCE.addTag("my_tag", "new_user");
BitLabs.INSTANCE.addTag("is_premium", true);


The Leaderboard widget shows your top 100 earning users and their corresponding earnings in your app's currency. And will open the Offerwall if clicked.


The rewards shown in the widget are custom to your app and will be paid by us to you and your users. By default these rewards are disabled and not shown so this widget only serves the purpose to display the best earning users. To enable the rewards and incentivise your users to do more surveys and offers in your app please contact us on: [email protected]

The earnings will reset at the end of each month and the top 100 users will get their corresponding reward. If a user is listed in the leaderboard it will see it's rank by the blue (You) besides the username.

All earnings and rewards in the leaderboard will be formatted as your app's settings set on our publisher dashboard.


If you implement the leaderboard without updating your offerwall and widget integration all users will just be called anonymous. To pass us the correct usernames to your provided user id you will have to add a tag with key username before launching the offerwall.


You can use getLeaderboard(onResponseListener) to get a LeaderboardFragment which you can add to any view in your Activity.

BitLabs.getLeaderboard {
	it?.let { leaderboardFragment ->
			.add(, leaderboardFragment)
BitLabs.INSTANCE.getLeaderboard(leaderboardFragment -> {
	if (leaderboardFragment == null) return;

		.add(, leaderboardFragment)

Whitelist HTTP Domains

Since BitLabs works with a plethora of survey providers, we can't always make sure that the domains are secured with HTTPS schemes. So we had to whitelist some providers.

If you want to remove or add a domain to the list:

  1. Download the network_security_config.xml
  2. Put the downloaded file inside [ProjectRootDirectory]/android/app/src/main/res/xml/
  3. Now you can add or remove to it any domain you want.

Complete the Google Play Data Safety questionnaire

Once you are ready to launch your app, you should adjust the Google Play Data Safety questionnaire in order to get your app published on Google Play. Read about it here:

Your next Step

You have now implemented BitLabs with your project. If you haven't done it already, it is time to configure server-to-server callbacks and the look and feel of your app.