Skip to content

Basic SDK Integration Steps

These are the required steps to integrate the Device Native SDK into your Android launcher app. The SDK is intended to be integrated with Android launcher apps that have system-level access.

1. Create an Account and Get a Device Key

First, create an account at DeviceNative. After registration, obtain your unique device key from the Settings Page, which you'll use in your application to initialize the SDK.

2. Add AAR Dependency

The DeviceNativeAds SDK is distributed as an AAR file. Follow the instructions below to install it.

2.1. Download the AAR File

You can find the latest AAR hosted here:

2.2 Place the AAR File in your Project

Place the DeviceNativeAds SDK in the libs folder of your Android project. If you don't have a libs folder, create one. It should be placed in the same folder as your src folder like so:


2.3 Add the AAR Dependency

Add the following dependency to your app's build.gradle file:

dependencies {
    implementation files('libs/com.devicenative.dna-v`latest-version`.aar')

or some Gradle versions:

dependencies {

Replace latest-version with the current version of the SDK.

3. Register the Data Orchestrator Service

In your AndroidManifest.xml, register the DNADataOrchestrator service:

<service android:name="com.devicenative.dna.DNADataOrchestrator" />

4. Add Required Permissions

Make sure to include the following permissions in your AndroidManifest.xml:

<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.QUERY_ALL_PACKAGES"/>
<uses-permission android:name="android.permission.PACKAGE_USAGE_STATS"/>

If you want to collect notifications for ad creative, you must have a Notification Listener registered like the example below.

No action needed here, but just remember the name of this class for later.

<service android:name=".notification.NotificationListener"
        <action android:name="android.service.notification.NotificationListenerService" />

6. Initialize the SDK

Initialize the SDK in your Application class's onCreate method:

public void onCreate() {

    DeviceNativeAds dna = DeviceNativeAds.getInstance(this);

    // any other code you have

Replace YOUR_DEVICE_KEY with the key obtained in step 1.

7. Clean Up Resources

In the Application class's onTerminate method, clean up SDK resources:

public void onTerminate() {

    DeviceNativeAds dna = DeviceNativeAds.getInstance(this);

    // any other code you have

Device Native can use the recent notification for an app as its creative, creating personalized experiences that drive high conversions. It's strongly recommended that you add the notification listener.

Open your notficiation listener class that you noticed in Step 5:

// This is your class
public class NotificationListener extends NotificationListenerService {

Find the listener service method that handles new notifications, and call the appropriate Device Native code as shown below:

public void onNotificationPosted(StatusBarNotification sbn) {

    DeviceNativeAds dna = DeviceNativeAds.getInstance(getApplicationContext());

    // your other handling code

Need Help?

Please email for assistance or questions about the process.