Getting Started

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

Firebase Cloud Messaging library is available starting with version 5.1.0 of Pushwoosh SDK only.

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

allprojects {
    repositories {
        jcenter ()
        maven {
            url "https://maven.google.com"
         }
    } 
}

2. Add pushwoosh and android support v4 services library dependencies into your application's build.gradle:

compile 'com.pushwoosh:pushwoosh:5.+'
compile 'com.android.support:support-v4:26.+'

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:

<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:

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

8 . Register for push notifications:

Pushwoosh.getInstance().registerForPushNotifications();

Getting Started

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