Getting Started
With the GFP SDK, you can monetize your Android app through ads from various ad providers. This guide explains how to integrate ads into your Android app using the GFP SDK.
Prerequisites
- Install or update to the latest version of Android Studio.
- minSdkVersion 23 or higher
Adding GFP SDK to Your App
1. Include the MavenCentral repository in your Gradle settings file.
- Kotlin DSL
- Groovy
dependencyResolutionManagement {
repositoriesMode.set(RepositoriesMode.FAIL_ON_PROJECT_REPOS)
repositories {
mavenCentral()
maven {
url = uri("https://artifactory.navercorp.com/artifactory/maven-release")
}
// . . .
}
}
dependencyResolutionManagement {
repositoriesMode.set(RepositoriesMode.FAIL_ON_PROJECT_REPOS)
repositories {
mavenCentral()
maven {
url "https://artifactory.navercorp.com/artifactory/maven-release"
}
// . . .
}
}
2. Add the following dependencies to your app-level build.gradle file.
It is recommended to use the GFP Android BoM for managing library versions provided by the GFP SDK.
- Kotlin DSL
- Groovy
dependencies {
// Import the BoM for the GFP platform
implementation(platform("com.naver.gfpsdk:gfpsdk-bom:8.13.0"))
// When using the BoM, you don't specify versions in GFP library dependencies
// Add the GFP Core dependency (required)
implementation("com.naver.gfpsdk:gfpsdk-core")
// Add the S2S mediation library dependency (required)
implementation("com.naver.gfpsdk.mediation:nda")
// TODO: Add the dependencies for any other mediation libraries you want to use
// For example, add the mediation library dependencies for Google Ad Manager, Meta Audience Network
implementation("com.naver.gfpsdk.mediation:dfp")
implementation("com.naver.gfpsdk.mediation:fan")
...
}
dependencies {
// Import the BoM for the GFP platform
implementation platform('com.naver.gfpsdk:gfpsdk-bom:8.13.0')
// When using the BoM, you don't specify versions in GFP library dependencies
// Add the GFP Core dependency (required)
implementation 'com.naver.gfpsdk:gfpsdk-core'
// Add the S2S mediation library dependency (required)
implementation 'com.naver.gfpsdk.mediation:nda'
// TODO: Add the dependencies for any other mediation libraries you want to use
// For example, add the mediation library dependencies for Google Ad Manager, Meta Audience Network
implementation 'com.naver.gfpsdk.mediation:dfp'
implementation 'com.naver.gfpsdk.mediation:fan'
...
}
3. Add the Publisher Code issued via the NAVER Ad Manager platform or your contact person to AndroidManifest.xml as follows.
<manifest>
<application>
<meta-data
android:name="com.naver.gfpsdk.PUBLISHER_CD"
android:value="YOUR_PUBLISHER_CODE" />
</application>
</manifest>
The Publisher Code is a required field. If omitted, the app may crash during startup. Ensure this value is included.
4. Add the Google Play Services SDK to collect AD ID.
The GFP SDK collects Google Advertising ID (AD ID) to support advanced ad targeting. To enable your application to retrieve AD ID, refer to the following:
- Kotlin DSL
- Groovy
dependencies {
implementation("com.google.android.gms:play-services-ads-identifier:17.0.1")
...
}
dependencies {
implementation 'com.google.android.gms:play-services-ads-identifier:17.0.1'
...
}
Additional Considerations
The following are additional considerations when integrating the GFP SDK.
SDK Initialization
The GFP SDK requires initialization for ad requests and monetization. However, initialization is automatically handled internally when the application starts, so no additional initialization code is needed.
If you need to control the initialization timing in specific scenarios, manual initialization is also available. For more details, refer to the Manual Initialization Guide.
App Set ID
App Set ID helps uniquely track users per device and developer account on the app store. To enable your application to retrieve App Set ID, refer to the following:
- Kotlin DSL
- Groovy
dependencies {
implementation("com.google.android.gms:play-services-appset:16.0.2")
...
}
dependencies {
implementation 'com.google.android.gms:play-services-appset:16.0.2'
...
}
Chrome Custom Tabs
To use Chrome Custom Tabs instead of an external browser when clicking ads, add the Chrome Custom Tabs library to your application.
- Kotlin DSL
- Groovy
dependencies {
implementation("androidx.browser:browser:1.4.0")
...
}
dependencies {
implementation 'androidx.browser:browser:1.4.0'
...
}
When Using WebView
If your app uses GFP Web SDK to display ads in a WebView, each WebView object must be registered with the SDK. This ensures accurate ad targeting and improves ad revenue by enabling communication with websites using the GFP Web SDK. Ensure you use version 8.2.4 or higher and apply the WebView Registration Guide.
Network Security Configuration
Some mediation networks provide ad creatives via cleartext (non-HTTPS) traffic. Since Android 9.0 (API 28) blocks HTTP traffic by default, this may impact user experience and ad revenue. To maximize revenue, it is recommended to allow HTTP traffic. Affected mediation networks include:
Choosing an Ad Format
Once the above steps are complete, you are ready to integrate ads using the GFP SDK. Now, select the ad format you want to use in your app and add the corresponding ads.
The GFP SDK supports various ad formats. Below are the main ad formats:
You can find the sample code for the GFP SDK in the GFP Android SDK GitHub repository.