Get Started
BlueStack Ads SDK provides functionalities for monetizing your mobile application: from premium sales with rich media, video and innovative formats, it facilitates inserting native mobile ads as well all standard display formats.
Prerequisites
Before You Start, BlueStack Ads requires minimum :
- Android 4.4 (API level 19) or higher.
- CompileSdkVersion at least 31.
- Android Studio 4.0 or higher.
Configure your app
Installation using Gradle
1) In the settings.gradle of your project, you must declare there repositories :
dependencyResolutionManagement {
...
repositories {
...
google()
mavenCentral()
...
}
...
}
2) Add the following dependency to your app's build.gradle, and make sure the latest SDK is used:
Mandatory :
- Bluestack Mediation SDK
dependencies {
// Bluestack SDK
implementation 'com.azerion:bluestack-sdk-core:5.0.2'
}
Update AndroidManifest.xml
Add the following permissions to your AndroidManifest.xml file inside the manifest tag but outside the <application> tag, if not done already:
<!-- Optional: Allows the SDK to access approximate location data based on cell towers to improve targeting. -->
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
<!-- Optional: Allows the SDK to access precise location data via GPS to improve targeting. -->
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
<!-- Optional: External storage is used for pre-caching features if available -->
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
Initialize the BlueStack Ads SDK
Before loading ads, initialize the BlueStack Ads SDK by calling BlueStack.initialize()
.
Once the SDK completes initialization,
it will provide an InitializationStatus instance through the initialization callback.
This needs to be done only once.
- Java
- Kotlin
import com.azerion.bluestack.BlueStack;
import com.azerion.bluestack.initialization.InitializationListener;
import com.azerion.bluestack.initialization.InitializationStatus;
class MainActivity extends AppCompatActivity {
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
...
BlueStack.INSTANCE.initialize(this, "YOUR_APP_ID", initializationStatus -> {
initializationStatus.getAdapterStatusMap().forEach((adNetworkName, adapterStatus) -> Log.d(TAG, "name: " + adapterStatus.getName() + "," + "state: " + adapterStatus.getState() + "," + "description: " + adapterStatus.getDescription()));
});
...
}
}
import com.azerion.bluestack.BlueStack
import com.azerion.bluestack.initialization.InitializationListener
import com.azerion.bluestack.initialization.InitializationStatus
class MainActivity : AppCompatActivity() {
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate()
...
BlueStack.initialize(this, "YOUR_APP_ID", object : InitializationListener {
override fun onInitialized(status: InitializationStatus) {
status.adapterStatusMap.forEach {(adNetworkName, adapterStatus) ->
Log.d(TAG, "name: ${adapterStatus.name}, state: ${adapterStatus.state}, description: ${adapterStatus.description}")
}
}
})
...
}
}