!!! Note: Due to Amazon's latest policy update, Bright SDK is currently not supported for Amazon apps. You may consider this integration guide for general android implementation and disregard the Amazon mentions. Thanks for understanding !!!
Step 1: Updating your Privacy Policy
Step 2: Extract SDK AAR from the distributive
Step 3: Integrate Bright SDK in your code
Step 3.3: Import the Bright SDK in your MainActivity code
Step 3.4: Initialize Bright SDK in your MainActivity code
Step 3.4.1: Customizing the consent dialog
Step 3.5: Ensure SDK initialization only happens once
Step 3.5.1: Encapsulate Application class code
Step 3.6: Add ‘pop up’ option in your ‘Subscription’ func
Step 3.7: Adding ‘opt-out’ option from settings
Step 3.7.1 Opt-out for Amazon FireTV
Step 3.8: Using BrightApi.showConsent to prompt the consent dialog
Step 3.10: Verify your integration
Step 3.11: Submit your integration
Marketing campaign for User Acquisition
Overview
This guide is for App developers who want to monetize an Android app with Bright SDK.
Bright SDK supports Android native apps written in Java and Kotlin, and also cross-platform development frameworks such as Unity, Flutter and Xamarin.
For Unity integration help refer to Unity Android SDK Integration Guide.
Integrating the Bright SDK into an app is the first step toward earning revenue. Once you've integrated the SDK, you will start seeing revenue in Bright SDK Dashboard in 24 hours.
This document will walk you through the steps needed to be taken in order to properly integrate Bright SDK into your app.
Adding Bright SDK to most of the apps takes 15 to 20 min.
Step 1: Updating your Privacy Policy
Bright Data works tirelessly to make sure users are fully aware of what it means to become a peer in Bright Data’s network. Please follow the terms of service additions that need to be done below.
- Add the following text to your Amazon App Store app description/FAQ
You will get <value: ads free version/free feature> in exchange for safely using some of your device’s resources (WiFi and very limited cellular data), and only in a manner that will not substantially affect the device's operation. You may turn this off from the settings menu. Please see our TOS [Link to TOS] and the SDK Privacy Policy at https://bright-sdk.com/privacy-policy for further information.
- Add the following text to your Terms of Service Web page (such as: TOS, EULA, or Privacy Policy):yes
In return for some of the premium features of ‘[name of Partner Solution]’, you may choose to be a peer on the Bright Data network. By doing so you agree to have read and
accepted the Terms of Service of the Bright SDK EULA:
https://bright-sdk.com/eula and Bright Data’s Privacy Policy https://brightdata.com/legal/sdk-privacy.
You may opt out of the Bright Data network by clicking [add clear description for how to opt-out].
Please note: the text above must be added in full to your Privacy Policy, including the links. In case you wish to add any addition text that is related to Bright SDK, please share with us as part of the app review process.
Answers to Amazon Privacy Questionnaire
Please make sure you complete the Amazon privacy questionnaire based on this article.
Step 2: Extract SDK AAR from the distributive
Download the latest Bright SDK from the Bright Data Dashboard or by clicking the link provided in the latest release email.
Once you unzip the SDK, you will find the SDK AAR file located in all directory.
Note that SDK AAR is obfuscated.
Copy it into your project /libs directory.
Step 3: Integrate Bright SDK in your code
By now you have updated your TOS and app store app description, downloaded the latest SDK distributive. Now you are ready to implement the SDK in your code.
Step 3.1: Prerequisites
Make sure you have the following:
- Latest Bright SDK version for Android
Step 3.2: Dependencies
In your app-level build.gradle file:
- Add to android:
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
In case you are using Java < v8, please contact our technical support.
- Add to dependencies:
implementation fileTree(dir: 'libs', include: ['*.aar'])
Example code:
|
dependencies { implementation 'androidx.constraintlayout:constraintlayout:2.1.4' |
- Add to allproject.repositories:
flatDir {dirs "$rootProject.projectDir/libs"}
Example code:
|
allprojects { repositories { jcenter() maven { url "https://maven.google.com" } flatDir {dirs "$rootProject.projectDir/libs"} } } |
Step 3.3: Import the Bright SDK in your MainActivity code
In your MainActivity code:
- Import Bright SDK:
import com.android.eapx - See example code on MainActivity file
|
package ... import ... import … import com.android.eapx |
Step 3.4: Initialize Bright SDK in your MainActivity code
- Create a new function startBrightSdk to set up the sdk and interaction elements using apis. Should be invoked only once on the first run.
- See example code on MainActivity file:
public class ActivityMain extends BaseActivity { |
Step 3.4.1: Customizing the consent dialog
While you are always invited to use the standard consent screen built into the Bright SDK, we highly encourage you to customize its design. Modifying the design to integrate smoothly with your app's interface and reflect its look & feel, typically leads to higher conversion rates.
There are two customization options you can choose from:
- CustomConsentSettings class allows you to modify Bright Data’s consent screen.
-
Use external consent - this option allows you to create a view in your app to get the user’s consent, with your own design. Our API allows you to pass the user’s consent to the SDK.
CustomConsentSettings
Please find all available settings for consent screen customization here.
To show a consent screen that matches your app’s UI design, use CustomConsentSettings.
protected void onCreate(Bundle savedInstanceState) { |
External consent screen
Subject to Bright SDK approval, you can create and use your own consent screen with Bright SDK. Please follow the following guidelines.
Design of your consent screen
1. Your screen must include the mandatory text below (marked in red), as well as links to our terms and privacy policies.
2. If you wish to translate your screen into other languages, please find the most common ones here. If there is a language you miss here, contact your partnership manager and ask for it. Make sure you only use these translations precisely, without additions or omissions.
This is what it looks like on the default Bright SDK screen:
Mandatory text
“To [Benefit to user], please allow Web Indexing by Bright Data to use your device's free resources and IP address to download public web data from the Internet.
None of your personal information is collected, except your IP address. Bright Data does not track you.”
- The link to "Bright Data” leads to "https://www.brightdata.com"
- The link to "Privacy Policy” leads to "https://bright-sdk.com/privacy-policy"
- The link to "End User License Agreement" leads to "https://bright-sdk.com/EULA"
- Clicking/tapping on "public web data" -> opens a popup with the following info:
See below some examples of a possible custom consent screens:
For Fire TV:
Replace the links with the following:
"Scan the QR Code to learn more about web indexing by Bright Data". You can use your own branded QR code or hosted version, leading to this URL: https://bright-sdk.com/users#learn-more-about-bright-sdk-web-indexing
See below some examples of a possible custom consent screens:
Integration code
Skip the default consent screen
|
// create a Settings object. Settings settings = new Settings(context); // set to true to prevent the consent screen from showing automatically settings.setSkipConsent(true); |
When showing the consent screen, notify the SDK
BrightApi.reportConsentShown(context);
|
The opt-in button (e.g. "I Agree”) should call
BrightApi.externalOptIn(context);
|
The opt-out button (e.g. "I Disagree”) should call
BrightApi.optOut(context);
|
If the user clicked the back button and closed the consent without making a choice call
Important - if you disable closing the consent screen using the back button do not call this method.
BrightApi.reportConsentBackPress(context);
|
Please contact Bright SDK before implementing in order to get pre-approved.
Step 3.5: Ensure SDK initialization only happens once
Executing startBrightSdk should only happen once.
Here is a code example from MainActivity file which ensures the initialization function will be executed only when it’s the first activity run.
|
protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); // ensure calling startBrightSdk only once if (savedInstanceState!=null) return; startBrightSdk(this); } |
Step 3.5.1: Encapsulate Application class code
NOTE: this section is only for the developers who have extended the Application class or its descendants (for example, MultiDexApplication). If this is not the case, you can skip to the next section.
In general, SDK is not vulnerable to the application code, because it is using a separate process for its service. Therefore application crashes, when they happen, shouldn't affect your daily peer count and service lifetime.
Exception is the Application code, which will be executed regardless of the process name. If this code crashes, it will crash the SDK service and it will have an impact on your revenue. To avoid this, we suggest the following:
Ensure you are not running any application code when inside the SDK service process:
|
public class MyApplication extends Application { @Override super.onCreate(); if (BrightApi.isSvcProcess()) return; // rest of your application code } } |
Alternatively, you can detect the service name by yourself and early exit from your Application.onCreate if it's matching the SDK service process name:
|
public void onCreate() { super.onCreate(); String processName = this.getProcessName(); if (processName!=null && (processName.endsWith("srvh") || processName.endsWith("srvj"))){ return; } // rest of your application code } |
You can use this article as the reference on how to detect process names in Android.
Step 3.6: Add ‘pop up’ option in your ‘Subscription’ func
In your subscription function, you should add the option to show Bright SDK pop up if the user decides to stop the subscription.
See code example from MainActivity:
|
void startSubscriptionProcess(Context context){ // another subscription code if (!subscribed) // ensure to show dialog on subscription cancel BrightApi.showConsent(context); } |
Step 3.7: Adding ‘opt-out’ option from settings
⚠️ If you are implementing bright SDK for FireTV apps, see section 3.7.1
⚠️ Read and implement this section carefully. The user must always be able to opt-out of Bright SDK after giving their initial consent.
Your app will usually first show the consent screen to the user on first run (or after a short “trial” period), the user will make a choice and SDK will act according to that choice.
Regardless of the user’s choice you must add an option for the user to opt-in/out of using SDK at any time. The user must always be able to opt-out of Bright SDK after giving their initial consent.
This means that you must add an opt-out option in your app - this is usually placed in the settings menu
- Add a switch with the label “Web Indexing”. The switch should clearly reflect the current status (is the user opted-in or not?).
- Below Web Indexing add your own text to emphasize the value users get when opting in.
- Include a way to give more information to the user (“Learn more”). The hyperlink should open a browser window with the following URL: https://bright-sdk.com/users#learn-more-about-bright-sdk-web-indexing.
- In general, you are free to choose the UX (radio button, switch, etc) but the opt-out option must be clearly labeled so users can freely opt-out.
See the examples below, illustrating both opted-in and opted-out scenarios:
Some ideas for value text:
| When opted-out | When opted-in |
| Enable to see fewer ads | When enabled you see fewer ads |
| Enable to get 100 extra coins | When enabled you get 100 extra coins |
| Enable to enjoy premium features | When enabled you enjoy premium features |
| Enable to get 2 free cars | When enabled you get 2 free cars |
| Enable to unlock more levels | When enabled you unlock more levels |
- Refrain from using the technical term “opt in” / “opt out”. We always prefer speaking value to users.
- Switching the toggle button ‘OFF’ will trigger a function that will clear prior selection of the user (peer/not peer) using BrightApi.optOut(context);
See code example from MainActivity:
|
void userRequestedToTurnOffBrightSdkFromOptions(Context context){ BrightApi.optOut(context); } |
Step 3.7.1 Opt-out for Amazon FireTV
Your app will usually first show the consent screen to the user on first run (or after a short “trial” period), the user will make a choice and SDK will act according to that choice.
Regardless of the user’s choice you must add an option for the user to opt-in/out of using SDK at any time. The user must always be able to opt-out of Bright SDK after giving their initial consent.
This means that you must add an opt-out option in your app - this is usually placed in the settings menu.
- Add a switch with the label “Web Indexing”. The switch should clearly reflect the current status (is the user opted-in or not?).
- Below Web Indexing add your own text to emphasize the value users get when opting in.
- Include a way to give more information to the user. It’s best to include a QR code that will lead to the web page that shows more info https://bright-sdk.com/users#learn-more-about-bright-sdk-web-indexing. The QR code must be accompanied by instructions: "Scan the QR Code to learn more about web indexing by Bright Data." You can use your own branded QR code to the URL above, or use the QR below, or the hosted version.
- In general, you are free to choose the UX (radio button, switch, etc) but the opt-out option must be clearly labeled so users can freely opt-out.
- FYI: You are free to add a pop up / confirmation dialog box to discourage the user from opting out (for example: “if you disable Web Indexing, you will start seeing ads. Do you want to see ads?”). You are responsible for the text and design for this implementation and it will be reviewed before publishing.
See the examples below, illustrating both opted-in and opted-out scenarios:
Some ideas for value text:
| When opted-out | When opted-in |
| Enable to see fewer ads | When enabled you see fewer ads |
| Enable to get 100 extra coins | When enabled you get 100 extra coins |
| Enable to enjoy premium features | When enabled you enjoy premium features |
| Enable to get 2 free cars | When enabled you get 2 free cars |
| Enable to unlock more levels | When enabled you unlock more levels |
Examples for common mistakes with opt-out settings screens:
Web Indexing Switch
| Example | Comments |
|
|
|
|
|
|
Opt-Out Messages (Optional but highly recommended)
| Example | Comments |
|
|
|
Step 3.8: Using BrightApi.showConsent to prompt the consent dialog
Use the BrightApi.showConsent method in your code in case you want to prompt the dialog again (not first time). This happens in case the user decides to opt-in (if he opt-out before), stopped subscription etc.
- To show dialog to the user, call
BrightApi.showConsent(Context context); - To show dialog to the user with customization after the SDK was already initialized:
BrightApi.showConsent(Context context, Settings settings);
See code example from MainActivity:
|
// show Bright SDK dialog explicitly, e.g. from settings void showBrightSdkDialog(Context context){ BrightApi.showConsent(context); |
Step 3.9: Configure ProGuard
If you are using ProGuard, make sure to update your settings to avoid known build issues. Add the following to your proguard-rules.pro:
-dontnote brdat.sdk.**
Step 3.10: Verify your integration
- Compile and run your application on your device or emulator
- Look for the cid string in your logs after a few minutes by searching ‘cskd/cid’ .
You should see a line like this in the logs:
2021-06-16 15:36:59.960 11557-11629/your.app.id I/cskd/cid: 54.221.207.68-33f08a02/ls17c2p443_54.221.207.68_64377 [radio0]
- If this line exists in the logs it means the integration is completed. If not, please ensure you are not suppressing application output, then contact us for support.
Step 3.11: Submit your integration
- Important: Bright SDK compliance team will verify the UX and functionality of the SDK integration, including consent screen, opt-out, value added to user, etc. Please do some internal QA prior to submitting the app for review.
- When you are ready to submit the app, the first step is running a self-check, which takes a few minutes and can save you precious time by identifying implementation issues. Details here.
- Submit the app for review by uploading the package (apk format) through the Bright SDK Dashboard :click the relevant appID and “Submit for Review” button.
- As part of the submission process you will go through our checklist questions, to help you validate your app compliance to some of our main guidelines. Paying attention to this checklist, as well as to our quality standards will lead to faster approval.
- We also welcome you to watch our guided tour video prior to submission. It highlights critical elements to pay attention to, ensuring a faster review process and transparent communication with your users.
- Please note that we will review each app up to 3 times. 3 review rejections, or failure to meet our minimum quality standards may lead to a final rejection of your app.
- Once the app is approved, you should publish it on Amazon app store. For specific instructions on how to fill in Amazon privacy questionnaire, see this article.
- Do not upload your apk with Bright SDK to Google Play store.
Unsupported devices
We are constantly working on improving our service. Nevertheless, some devices may not support Bright SDK at the moment. If you face integration issues, this might be the cause. Feel free to contact us for assistance.
*Important note: When submitting the approved app to Amazon App store, make sure you do not enable it for non-Amazon devices (details here).
How to update SDK
Download the latest SDK from our website and follow these simple steps:
- replace bright_sdk.aar in the libs folder with the updated version.
- If some methods are not available, use invalidate caches from the “File” menu in Android Studio.
Migrating from API V1 to V2
The new API introduces a new consent screen that you can customize to match your app’s UI design. Customizing the consent screen can help increase the conversion rate.
All main methods are deprecated and replaced by BrightApi
This following V1 code is equivalent to the V2 code that follows
V1
void start_bright_sdk(Context ctx){ |
V2
void startBrightSdk(Context ctx){ |
API documentation
BrightApi
| Public methods | |
| static void |
init(Context context, Settings settings) Should be called in your first activity only once per run. |
| static void |
showConsent(Activity activity) Displays the consent dialog. Can be used when a user tries to close an ad or clicks the checkbox to activate Bright SDK. |
| static void |
showConsent(Activity activity, Settings settings) Displays the consent dialog, with a new settings object |
| static void |
optOut(Context context) Revokes the user’s consent and sets Choice.NOT_PEER. |
| static Boolean |
getConsentChoice(Context context) Return true of the user is peer, false if not peer. |
| static boolean | isSvcProcess() |
| static void |
setTrackingId(String trackingId) Add unique tracking id for reports and debugging. Should be called before BrightApi.init |
| static void |
reportConsentShown(Context context) This method requires special permission. Using it without proper permission will result in an exception. |
| static void | reportConsentBackPress(Context context) This method requires special permission. Using it without proper permission will result in an exception. |
| static void | reportConsentOptOut(Context context) This method requires special permission. Using it without proper permission will result in an exception. |
| Static boolean | isAmazonParentalControlEnabled(Context context) |
Settings
| Public constructor | |
| Settings(Context context) | |
| Public methods | |
| String |
getAppId() Application Id as defined in ApplicationInfo packageName. |
| String |
getAppName() As defined in ApplicationInfo loadLabel. |
| void |
setSkipConsent(boolean skipConsent) Set to true to prevent the consent dialog from being shown automatically. |
| void |
setLanguage(ConsentLanguage language) Set to override the device default language |
| void |
setBenefit(String benefit) This text will be used as the prefix for the consent dialog text. e.g. “To use the app with no ads” |
| void |
setAgreeBtn(String agreeBtn) Set the text of the agree button.If not set default text will be used, |
| void |
setDisagreeBtn(String disagreeBtn) Set the text of the disagree button. |
| void |
setOnStatusChange(OnStatusChange onStatusChange) Register to a OnStatusChange callback interface. |
| void |
setMinJobId(int minJobId) Set the min job id. Should be used if you are using JobScheduler to avoid job collapses.
|
| void |
setMaxJobId(int maxJobId) Set the max job id. Should be used if you are using JobScheduler to avoid job collapses. |
| void |
setCustomConsentSettings( CustomConsentSettings customConsentSettings) |
| void |
setShowAppIcon(boolean showAppIcon)
If showAppIcon is true the consent screen will display the default App icon |
| void |
setShowAppIcon(boolean showAppIcon, int appLogoResourceId)
If showAppIcon is true the consent screen will display the image resource set in appLogoResourceId |
| void |
setShowAppIcon(boolean showAppIcon, byte[] imageBytes) If showAppIcon is true the consent screen will show the image set in imageBytes |
| void |
setOptOutInstructions(String optOutInstructions) |
| void | setCampaignId(String campaignId) |
| void | setBackPressListener(Runnable backPressListener) |
CustomConsentSettings
| Values | |
| void | setConsentTitle(String consentTitle) |
| void |
setAppTitleTextColor(String appTitleTextColor) |
| void | setAppTitleTypeface(CustomTypeface appTitleTypeface) |
| void |
setBodyBackgroundColor(String bodyBackgroundColor) |
| void |
setBodyBackgroundImageResource( int bodyBackgroundImageResource) |
| void | setBodyBackgroundImageBytes(byte[] bodyBackgroundImageBytes) |
| void |
setBodyBackgroundShadow(boolean bodyBackgroundShadow) |
| void | setScreenBackgroundColor(String screenBackgroundColor) |
| void |
setScreenBackgroundImageResource( int screenBackgroundImageResource) |
| void |
setScreenBackgroundImageResource( int screenBackgroundImageResource, boolean fillScreenBackground) |
| void | setScreenBackgroundImageBytes(byte[] screenBackgroundImageBytes |
| void |
setScreenBackgroundImageBytes( byte[] screenBackgroundImageBytes, boolean fillScreenBackground) |
| void | setConsentTextColor(String consentTextColor) |
| void |
setConsentTextTypeface(CustomTypeface consentTextTypeface) |
| void | setAgreeButtonImageResource(int agreeButtonImageResource) |
| void |
setDisagreeButtonImageResource( int disagreeButtonImageResource) |
| void | setAgreeButtonImageBytes(byte[] agreeButtonImageBytes) |
| void | setDisagreeButtonImageBytes(byte[] disagreeButtonImageBytes) |
| void | setAgreeButtonTextColor(String agreeButtonTextColor) |
| void | setDisagreeButtonTextColor(String disagreeButtonTextColor) |
| void |
setAgreeButtonTypeface( CustomTypeface agreeButtonTypeface) |
| void |
setDisagreeButtonTypeface( CustomTypeface disagreeButtonTypeface) |
| void | setConsentTextLinksColor(String consentTextLinksColor) |
| void |
setAgreeButtonBackgroundColor( String agreeButtonBackgroundColor) |
| void |
setDisagreeButtonBackgroundColor( String disagreeButtonBackgroundColor) |
| void | setPrivacyMessageTextColor(String privacyMessageTextColor) |
| void | setPrivacyMessageLinksColor(String privacyMessageLinksColor) |
| void |
setPrivacyMessageTextTypeface( CustomTypeface privacyMessageTextTypeface) |
| void |
setNetworkIconsTextTypeface( CustomTypeface networkIconsTextTypeface) |
| void | setNetworkIconsColorFilter(String networkIconsColorFilter) |
| void |
setNetworkIconsTextColor( String networkIconsTextColor) |
| void |
setNetworkIconsTextTypeface( CustomTypeface networkIconsTextTypeface) |
| void | setHideNetworkIcons(boolean hideNetworkIcons) |
| void | setQrCodeColorFilter(String qrCodeColorFilter) |
| void | setQrCodeBackgroundColor(String qrCodeBackgroundColor) |
| void | setCustomTypeface(CustomTypeface customTypeface) |
| void | setTopIconColorFilter(String topIconColorFilter) |
| void | setHideConsentIcon(boolean hideConsentIcon) |
CustomTypeface
| Public constructors | |
| CustomTypeface() | |
| CustomTypeface(Typeface typeface) | |
|
CustomTypeface(CustomConsentSettings.CustomFontFamily fontFamily, CustomConsentSettings.CustomTextStyle textStyle) |
|
| Public methods | |
| void | setTypeface(Typeface typeface) |
| void |
setFontFamily( CustomConsentSettings.CustomFontFamily fontFamily) |
| void |
setTextStyle( CustomConsentSettings.CustomTextStyle textStyle) |
Choice
| Values | |
|---|---|
| Choice.NONE |
The consent screen wasn’t shown yet or the user didn’t make a choice. int value: 0 |
| Choice.PEER |
The user chose to be a peer. This value should be reflected in the settings screen of the app, so the user can opt-out. int value: 1 |
| Choice.NOT_PEER |
The user chose to not be a peer. This value should be reflected in the settings screen of the app, so the user can opt-in. int value: 4 |
ConsentLanguage
| Values | |
|---|---|
| en, de, es, fr, it, ja, pt, ru, tr |
|
CustomFontFamily
| Values | |
|---|---|
|
Casual, cursive, monospace, sans_serif, sans_serif_black, sans_serif_light, sans_serif_medium, sans_serif_smallcaps, sans_serif_thin, sans_serif_condensed, sans_serif_condensed_light, sans_serif_condensed_medium, serif, serif_monospace |
|
CustomTextStyle
| Values | |
|---|---|
|
bold, bold_italic, italic, normal |
|
Marketing campaign for User Acquisition
Bright SDK sponsorship
Bright SDK offers selected partners marketing campaign funding for user acquisition, on top of the payment agreed on in the signed agreement. One of the criteria a partner must comply with to become eligible for being considered for the program is implementing an advertising platform SDK, such as Chartboost, or setting up S2S (server-to-server) tracking using a 3rd party platform (adjust, AppsFlyer, Kochava, Singular). For more information please contact your account manager.
Troubleshooting
Bright SDK support
Feel free to contact your account manager for tech support.
Bright SDK Dashboard
--- End of document ---