SDK integration
Última actualización
Última actualización
To integrate our SDK for React Native, it is needed to run the following command in the project's root:
The latest version of the React Native SDK is 1.6.1
Next, the following Maven repositories need to be added inside the allprojects > repositories
block of the android/build.gradle
file:
Last, if not already done, the MultiDex support must be enabled by adding the following line in the android > defaultConfig
block of the android/app/build.gradle
file:
To improve the eCPM of Google's Open Bidding partners, it is needed to add a <meta-data>
element in the android/app/src/main/AndroidManifest.xml
file, inside the <application>
block.
This value can be found in our dashboard, inside the app details, under the name Google App ID
.
It is very recommended to request the user consent to be able to show personalised ads. This will allow to display content of more interest and generate higher revenues.
There are two options to do the SDK initialization:
The most recommended option is to do the initialization in the Application
class of the app. To do son, the following code has to be integrated in the onCreate()
method of the MainApplication.java
file:
In this option, the SDK initialization would be directly done in the JavaScript code of the project. To do so, the following lines have to be added to the code in a proper place:
To verify the integration, the SDK provides a test mode that allows the app to always receive ads.
Beside the option that is available in our dashboard, you can programatically enable this test mode, from the SDK itself, by using the following code:
You can consult the following section to implement this request and obtain the user consent: