Using Services in Passive Mode
Appodeal SDK already includes services such as Adjust, AppsFlyer, and Firebase, and we initialize them automatically with Appodeal initialization.
If you want to be able to initialize services and use their methods yourself, then you need to follow the steps below.
Contact Us
In order to use services in passive mode, you need to contact our support via live chat or email [email protected] with the following information:
- Links to the apps in the store where you want to initialize Adjust/AppsFlyer/Firebase on your own.
Integrate Adjust, AppsFlyer and Firebase
Complete all the steps from our integration guide., and make sure to include services in your build.
Add dependencies below to your app-level build.gradle:
- Kotlin
- Groovy
dependencies {
//Adjust
implementation("com.adjust.sdk:adjust-android:4.33.2")
implementation("com.android.installreferrer:installreferrer:2.2")
// Add the following if you are using the Adjust SDK inside web views on your app
implementation("com.adjust.sdk:adjust-android-webbridge:4.33.2")
//AppsFlyer
implementation("com.appsflyer:af-android-sdk:6.9.4")
implementation("com.appsflyer:adrevenue:6.9.1")
//Firebase
//Java
implementation("com.google.firebase:firebase-analytics:21.2.0")
implementation("com.google.firebase:firebase-config:21.2.0")
//Kotlin
implementation("com.google.firebase:firebase-analytics-ktx:21.2.0")
implementation("com.google.firebase:firebase-config-ktx:21.2.0")
}
dependencies {
//Adjust
implementation 'com.adjust.sdk:adjust-android:4.33.2'
implementation 'com.android.installreferrer:installreferrer:2.2'
// Add the following if you are using the Adjust SDK inside web views on your app
implementation 'com.adjust.sdk:adjust-android-webbridge:4.33.2'
//AppsFlyer
implementation 'com.appsflyer:af-android-sdk:6.9.4'
implementation 'com.appsflyer:adrevenue:6.9.1'
//Firebase
//Java
implementation 'com.google.firebase:firebase-analytics:21.2.0'
implementation 'com.google.firebase:firebase-config:21.2.0'
//Kotlin
implementation 'com.google.firebase:firebase-analytics-ktx:21.2.0'
implementation 'com.google.firebase:firebase-config-ktx:21.2.0'
}
Complete basic integration steps for AppsFlyer, Adjust and Firebase,
Initialize Adjust
After you have contacted our support team and got confirmation to go further, you can initialize Adjust on your own in the onCreate method and use all its methods according to the official documentation.
- Kotlin
- Java
import com.adjust.sdk.Adjust
import com.adjust.sdk.AdjustConfig
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
initializeAdjust()
}
// Initialize Adjust
fun initializeAdjust() {
val appToken = "YourAppToken"
val environment = AdjustConfig.ENVIRONMENT_PRODUCTION
val config = AdjustConfig(requireContext(), appToken, environment)
config.setLogLevel(LogLevel.VERBOSE)
Adjust.onCreate(config)
Adjust.onResume()
}
import com.adjust.sdk.Adjust;
import com.adjust.sdk.AdjustConfig;
public void onCreate() {
super.onCreate();
initializeAdjust();
}
// Initialize Adjust
public void initializeAdjust () {
String appToken = "YourAppToken";
String environment = AdjustConfig.ENVIRONMENT_PRODUCTION;
AdjustConfig config = new AdjustConfig(this, appToken, environment);
config.setLogLevel(LogLevel.VERBOSE);
Adjust.onCreate(config);
Adjust.onResume();
}
When running tests, you should ensure that your environment is set to AdjustConfig.ENVIRONMENT_SANDBOX.
Change this to AdjustConfig.ENVIRONMENT_PRODUCTION before you submit your application to the Google Play.
Initialize AppsFlyer
After you have contacted our support team and got confirmation to go further, you can initialize
AppsFlyer on your own in the onCreate method and use all its methods according to the official
documentation and AppsFlyer ad revenue
guide.
- Kotlin
- Java
import com.appsflyer.AppsFlyerLib
import com.appsflyer.adrevenue.AppsFlyerAdRevenue
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
initializeAppsFlyer()
}
// Initialize AppsFlyer
fun initializeAppsFlyer() {
val appsflyerDevKey = "YOUR_AF_DEV_KEY"
AppsFlyerLib.getInstance().setLogLevel(AFLogger.LogLevel.VERBOSE)
AppsFlyerLib.getInstance().init(appsflyerDevKey,
object : AppsFlyerConversionListener{
override fun onConversionDataSuccess(conversionData: MutableMap<String, Any>?) {
//Wait until conversionData was received before run Appodeal.initialize()
}
override fun onConversionDataFail(reason: String?) {}
override fun onAppOpenAttribution(map: MutableMap<String, String>?) {}
override fun onAttributionFailure(reason: String?) {}
},
this)
AppsFlyerLib.getInstance().start(this, appsflyerDevKey, object : AppsFlyerRequestListener {
override fun onSuccess() {
Log.d(LOG_TAG, "Launch sent successfully, got 200 response code from server")
}
override fun onError(code: Int, error: String) {
Log.d(LOG_TAG, "Start failed. \nError code: $code \nError description: $error")
}
})
val builder = AppsFlyerAdRevenue.Builder(this)
AppsFlyerAdRevenue.initialize(builder.build())
}
import com.appsflyer.AppsFlyerLib;
import com.appsflyer.adrevenue.AppsFlyerAdRevenue;
public void onCreate() {
super.onCreate();
initializeAppsFlyer();
}
// Initialize AppsFlyer
public void initializeAppsFlyer() {
String appsflyerDevKey = "YOUR_AF_DEV_KEY";
AppsFlyerLib.getInstance().setLogLevel(AFLogger.LogLevel.VERBOSE);
AppsFlyerLib.getInstance().init("appsflyerDevKey",
new AppsFlyerConversionListener() {
@Override
public void onConversionDataSuccess(Map<String, Object> conversionData) {
// Wait until conversionData was received before run Appodeal.initialize()
}
@Override
public void onConversionDataFail(String reason) {}
@Override
public void onAppOpenAttribution(Map<String, String> map) {}
@Override
public void onAttributionFailure(String reason) {}
},
this);
AppsFlyerLib.getInstance().start(this, appsflyerDevKey, object : AppsFlyerRequestListener {
@Override public void onSuccess() {
Log.d(LOG_TAG, "Launch sent successfully, got 200 response code from server");
}
@Override public void onError(int code, @NonNull String error) {
Log.d(LOG_TAG, "Start failed. \nError code: " + code + "\nError description: " + error);
}
});
String builder = AppsFlyerAdRevenue.Builder(this);
AppsFlyerAdRevenue.initialize(builder.build());
}
Initialize Firebase
After you have contacted our support team and got confirmation to go further, you don't need to initialize Firebase, as this is already done on our side.
Firebase analytics will work automatically, and you can use any methods you want, from Firebase Analytics and Firebase Remote-Config.
If you want to use Firebase Remote-Config in your app, then you need to set it up as shown below and in the official documentation.
- Kotlin
- Java
import com.google.firebase.ktx.Firebase
import com.google.firebase.remoteconfig.FirebaseRemoteConfig
import com.google.firebase.remoteconfig.ktx.remoteConfigSettings
import com.google.firebase.remoteconfig.ktx.remoteConfig
// Set up Firebase Remote-Config
fun setUpRemoteConfig() {
val remoteConfig: FirebaseRemoteConfig = Firebase.remoteConfig
val configSettings = remoteConfigSettings {
minimumFetchIntervalInSeconds = 3600 // DEFAULT_MINIMUM_FETCH_INTERVAL_IN_SECONDS
}
remoteConfig.setConfigSettingsAsync(configSettings)
}
import com.google.firebase.remoteconfig.FirebaseRemoteConfig;
import com.google.firebase.remoteconfig.FirebaseRemoteConfigSettings;
// Set up Firebase Remote-Config
public void setUpRemoteConfig() {
FirebaseRemoteConfig mFirebaseRemoteConfig = FirebaseRemoteConfig.getInstance();
FirebaseRemoteConfigSettings configSettings = new FirebaseRemoteConfigSettings.Builder()
.setMinimumFetchIntervalInSeconds(3600) // DEFAULT_MINIMUM_FETCH_INTERVAL_IN_SECONDS
.build();
mFirebaseRemoteConfig.setConfigSettingsAsync(configSettings);
}
Track In-app Purchases
You can track in-app purchase information and send info to Appodeal servers for analytics. It allows users to group by the fact of purchasing in-apps.
This will help you adjust the ads for such users or turn them off if needed.
To track in-app purchases, please refer to this guide
Event Tracking
Thanks to in-app events, you can track user activity inside your app. You can keep track of events such as registration, passing levels, purchases, etc., as in-app events.
The implementation of in-app events is mandatory for all post-install analysis purposes.
You can send events to Adjust, AppsFlyer, and Firebase using the methods from our documentation.