Skip to main content

Pushwoosh and Adjust Integration

Push-notifications in all applications must be developed in accordance with the following instructions:
Notification Factory
Customize Android SDK


  1. Include the following Maven repository URL in project's build.gradle:

allprojects {

    repositories {

        google ()




  1. Add pushwoosh library dependencies into your application's build.gradle:

implementation 'com.pushwoosh:pushwoosh-firebase:6.6.5'

  1. Go to Firebase and create a Firebase project.

  1. Register your app with Firebase.

  1. Add a Firebase configuration file in your app.

  • You can get google-services.json file from following path in firebase console:

Go to firebase project setting and click on the google-services.json button to download.

  • Move your configuration file into the module (app-level) root directory of your app. (Under dir app/)

  1. Add Firebase SDK and plugin.

  • Add the following lines in root-level (project-level) Gradle file under dependencies section.

classpath ''

Full code of root-level (project-level) Gradle file:

buildscript {

    repositories {

      // Make sure that you have the following two repositories

      google()  // Google's Maven repository

      mavenCentral()  // Maven Central repository


    dependencies {

      // Add the dependency for the Google services Gradle plugin

      classpath ''



allprojects {


  repositories {

    // Make sure that you have the following two repositories

    google()  // Google's Maven repository

    mavenCentral()  // Maven Central repository



  • Add the following lines in module (app-level) Gradle file under plugins section.

plugins {

    id ''

    // Add the Google services Gradle plugin

    id ''



  • Add the firebase and push notification dependency in module (app-level) Gradle file under dependencies section.

dependencies {

      //Add the dependency for the Firebase Push Notification

      implementation ''


  1. Now, Sync the project.

  1. Add the following metadata to AndroidManifest.xml inside <application> tag:

<meta-data android:name="com.pushwoosh.appid" android:value="XXXXX-XXXXX" />

<meta-data android:name="com.pushwoosh.senderid" android:value="@string/fcm_sender_id" />

  • com.pushwoosh.appid is your Pushwoosh Application Code

  • com.pushwoosh.senderid is the Sender ID you received from Firebase Console 

  • You can get sender id from Firebase project> Project settings> Cloud messaging tab.

Please note that you need to add fcm_sender_id to res/values/strings.xml of your Android project, Like this:


<string name="fcm_sender_id">123456789012</string>


  1. Register for push notifications, Add following line in your app Application class, inside onCreate() method:


class MainActivity : Application() {

    override fun onCreate(savedInstanceState: Bundle?) {







  • Now, Pushwoosh setup is completed.

Adjust SDK integration

  1. Add adjust library dependencies in build.gradle file under dependencies section.

 dependencies {

   implementation 'com.adjust.sdk:adjust-android:4.33.0'

   implementation ''

   implementation ''


  1. Add permissions.

  • The Adjust SDK requires the following permissions. Add them to your AndroidManifest.xml file if they are not already present:

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

<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/>

  1. Set up Proguard.

  • If you are using Proguard in your application, add the following lines to your Proguard file:

  • Move following lines in file, which is available in Gradle scripts.

-keep class com.adjust.sdk.** { *; }

-keep class {

    int SUCCESS;


-keep class {$Info getAdvertisingIdInfo(android.content.Context);


-keep class$Info {

    java.lang.String getId();

    boolean isLimitAdTrackingEnabled();


-keep public class** { *; }

  1. Set up install referrer, Add the following code lines in AndroidManifest.xml file inside  <application> tag.




    android:exported="true" >


        <action android:name="" />



  1. Integrate the SDK into your app.

1. Create a class that extends the Application.

2. Open the AndroidManifest.xml file and locate the <application> element.

3. Add the android:name attribute and set it to the name of your application class. For example, if your Application class is named GlobalApplication:



   <!-- ... -->


4. In your Application class, find or add the onCreate method and AdjustLifecycleCallbacks class. Add the following code to initialize the Adjust SDK:

public class GlobalApplication extends Application {


    public void onCreate() {


        String appToken = "{YourAppToken}";

        String environment = AdjustConfig.ENVIRONMENT_SANDBOX;

        AdjustConfig config = new AdjustConfig(this, appToken, environment);


        registerActivityLifecycleCallbacks(new AdjustLifecycleCallbacks());


class AdjustLifecycleCallbacks : Application.ActivityLifecycleCallbacks {

    override fun onActivityCreated(activity: Activity, savedInstanceState: Bundle?) {


    override fun onActivityStarted(activity: Activity) {


    override fun onActivityResumed(activity: Activity) {



    override fun onActivityPaused(activity: Activity) {



    override fun onActivityStopped(activity: Activity) {


    override fun onActivitySaveInstanceState(activity: Activity, outState: Bundle) {


    override fun onActivityDestroyed(activity: Activity) {




Tip: You can find your app token in your Adjust dashboard.

  1. Set the environment variable to either sandbox or production mode.


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 App Store.

String environment = AdjustConfig.ENVIRONMENT_SANDBOX;

String environment = AdjustConfig.ENVIRONMENT_PRODUCTION;

  1. Build your app.

Customize Pooshwoosh Notifications

For, Getting custom data from pushwoosh notification follow the below steps.

  1. Add the following class which extends NotificationServiceExtension.

public class MyNotificationServiceExtension extends NotificationServiceExtension {


    protected void startActivityForPushMessage(PushMessage message) {

      // super.startActivityForPushMessage() starts default launcher activity 

      // or activity marked with ${applicationId}.MESSAGE action.

      // Simply do not call it to override this behaviour.

        // super.startActivityForPushMessage(message);


        boolean isPromoAction = false;

        try {

            JSONObject jsonObject = new JSONObject(message.getCustomData());

            if (jsonObject.has("pushwoosh"))


                if (jsonObject.getString("pushwoosh").equals("promo"))


                    isPromoAction = true;



        } catch (JSONException e) {



        // start your activity instead:

        Intent launchIntent;

        if (isPromoAction) {

            launchIntent = new Intent(getApplicationContext(), SuperSaleActivity.class);

        } else {

            launchIntent  = new Intent(getApplicationContext(), reliance.class);


        launchIntent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_RESET_TASK_IF_NEEDED);




  • In the above code, “pushwoosh” is a custom key which is defined in the pushwoosh dashboard.

  • Get value from custom key like this:


  1. Add meta-data in AndroidMenifest.xml file.



            android:value="com.soiloker.streetview.MyNotificationServiceExtension" />

  1. Log the subscription event in Adjust SDK.

- Add the following lines inside the onPurchasesUpdated() method of Google In-app purchase.

skuDetail?.let { skuD->                       Constant.logSubscriptionEvent(skuD.priceAmountMicros,skuD.priceCurrencyCode,skuD.sku,purchase.orderId,purchase.signature,purchase.purchaseToken,purchase.purchaseTime)    }


- Create a class named Constant.kt and add the following method inside Constant.kt class.

fun logSubscriptionEvent(price:Long,currency:String,sku:String ,orderId:String,signature:String,purchaseToken:String,purchaseTime:Long)


        val subscription = AdjustPlayStoreSubscription(








        subscription.purchaseTime = purchaseTime




fun adjustEvent(eventName: String) {



    fun pushWooshTagsForSubscription(tag: Boolean) {

        Pushwoosh.getInstance().setTags(Tags.booleanTag("SubscriptionPurchased", tag))


Events Needs to be logged with Adjust

Event Names

const val ADJUST_EXIT_SUB_EVENT = "" // when user click on cross icon in Nomral subscription screen

const val ADJUST_NOTIFICATION_SHOWED_EVENT = "" //when we show notification

const val ADJUST_NOTIFICATION_CLICKED_EVENT = ""  // when user click on notification 

const val ADJUST_DISCOUNT_EXIT_EVENT = "" // when user click on cross icon in Special subscription screen

const val ADJUST_DISCOUNT_PROMO_PAY = "" // when user click on purchase in Special subscription screen