Integrate Pushwoosh Android SDK

Follow the steps below to get your Android application ready to receive pushes

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

build.gradle
allprojects {
repositories {
google ()
jcenter ()
}
}

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

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

Replace "+" with the current version of Pushwoosh and Android Support libraries.

3. Open your project in Android Studio. Go Tools > Firebase > Cloud Messaging and click "Set up Firebase Cloud Messaging":

4. Connect your app with Firebase, grant Android Studio access to your Google account (if needed), and create a new Firebase project:

If you have an existing Firebase project, choose it from the list.

5. Add FCM to your application and accept changes:

6. Set up the Android platform in Pushwoosh Control Panel following the steps from the configuration guide.

7. Add the following metadata to AndroidManifest.xml:

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

Where:

  • com.pushwoosh.appid is your Pushwoosh Application Code

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

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

string.xml
<resources>
<string name="fcm_sender_id">123456789012</string>
</resources>

8. Register for push notifications:

Pushwoosh.getInstance().registerForPushNotifications();