Skip to content

Integrate Pushwoosh Android SDK

This section contains information on how to integrate the Pushwoosh SDK into your Android application.

Prerequisites

To integrate the Pushwoosh Android SDK into your app, you will need the following:

Integration steps

1. Set up Firebase Cloud Messaging

First, connect your Android project with Firebase:

  • Open your project in Android Studio
  • Navigate to Tools > Firebase > Cloud Messaging and click “Set up Firebase Cloud Messaging”
  • Follow the wizard instructions. In the final step, the wizard will add the necessary dependencies to your build.gradle files

2. Add Pushwoosh SDK

Add the pushwoosh library dependency to your application’s build.gradle:

build.gradle
implementation 'com.pushwoosh:pushwoosh-firebase:6.+'

Replace ”+” with the current version of Pushwoosh Android SDK

3. Add Pushwoosh metadata to AndroidManifest.xml

Open your AndroidManifest.xml file and add the following metadata inside the <application> tag:

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

Where:

  • com.pushwoosh.appid is your Pushwoosh Application Code
  • com.pushwoosh.apitoken is your Pushwoosh API Token

To set com.pushwoosh.senderid, add fcm_sender_id to your project’s res/values/strings.xml file:

res/values/strings.xml
<resources>
<string name="fcm_sender_id">__YOUR_FCM_SENDER_ID__</string>
</resources>

4. Initialization code

Register for push notifications by adding this code to your initialization logic:

Pushwoosh.getInstance().registerForPushNotifications()

5. Run the project

  1. Build and run the project.
  2. Go to the Pushwoosh Control Panel and send a push notification.
  3. You should see the notification in the app.

Troubleshooting

If you encounter any issues during the integration process, please refer to the support and community section.