WonderPush - Push Notification Service Documentation

The WonderPush Developer Hub

Welcome to the WonderPush developer hub. You'll find comprehensive guides and documentation to help you start working with WonderPush as quickly as possible, as well as support if you get stuck. Let's jump right in!

Get Started    

Android Quickstart

SETUP - Android SDK Setup Guide.

Prerequisites

Getting started with WonderPush is easy.

You'll need:

  • Android Studio
  • A device or emulator with Google Play services installed and up-to-date
  • A Firebase account

If you haven't already, sign up for a free account on wonderpush.com.

Upgrading from a previous version of the Android SDK?

Follow this guide to update your integration.

Step 1. Create your project

Click on New Project:

Choose a name for your project and select Android as a platform then click Create:

Already have a project?

Just add the Android platform to any existing project by going to Settings, selecting the first tab named after your project and clicking Edit. You'll be presented a form that lets you add a platform.

Step 2. Fill your Firebase credentials in the dashboard

  1. Locate your Server Key and Sender ID in the Firebase project Cloud Messaging settings.
In your Firebase project console, click the *gear icon* (⚙️) and select *Project settings* and go to the *Cloud Messaging* tab.

In your Firebase project console, click the gear icon (⚙️) and select Project settings and go to the Cloud Messaging tab.

  1. Go to your WonderPush dashboard, in the Settings / Configuration page, select the Android app tab.
  1. Paste the Server key.
  2. Click Update.

Step 3. Add the SDK as a dependency

Add the WonderPush Android SDK as a dependency of your app/build.gradle file:

dependencies {
    // Android Studio will recommend to replace the + range with a specific version.
    // If you do so, do not forget to upgrade it regularly.
    // See: https://github.com/wonderpush/wonderpush-android-sdk/releases
    // See: https://discuss.wonderpush.com/c/announcements
    implementation 'com.wonderpush:wonderpush-android-sdk:3.+'
}

Step 4. Configure SDK

Configure the WonderPush Android SDK from your app/build.gradle file:

android {
    defaultConfig {
        // Note that it's important to keep the double quotes as part of the third argument
        // as this represents a string in Java code
        buildConfigField 'String', 'WONDERPUSH_CLIENT_ID', '"YOUR_CLIENT_ID"'
        buildConfigField 'String', 'WONDERPUSH_CLIENT_SECRET', '"YOUR_CLIENT_SECRET"'
        buildConfigField 'String', 'WONDERPUSH_SENDER_ID', '"YOUR_SENDER_ID"'
    }
}

Replace YOUR_CLIENT_ID and YOUR_CLIENT_SECRET with the appropriate values you find in the Settings / Configuration page, in the Android app tab.
Replace YOUR_SENDER_ID with the Firebase Sender ID from step 2
Note that it's important to keep the double quotes as part of the third argument as this represents a string in Java code.

Step 5. Sync Gradle and build

Click Sync now in the banner that showed up in your editor, or click the Sync project with Gradle files button in the toolbar.
Then build your project.

Getting an error?

Step 6. Setup ProGuard

Recommended

In order to have meaningful stack traces of your application released in Google Play, we recommend that you keep ProGuard from obfuscating WonderPush class names, file names and line numbers.

Add the following to your proguard-rules.pro file:

# For easier debugging, we strongly recommend keeping WonderPush class names unobfuscated
-keepattributes SourceFile,LineNumberTable,Signature
-keepnames class com.wonderpush.sdk.** {
    *;
}
-keepnames interface com.wonderpush.sdk.** {
    *;
}

When using ProGuard, don't forget to save your mapping.txt of each release in a safe place.
This file is found in app/build/outputs/mapping/release/mapping.txt.

Read more about decoding obfuscated stack traces.

Receive your first push!

Build and run your application.

Wait a couple of minutes and receive the default welcome notification:

Congratulations, you're done!