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    

Upgrading to Android SDK v3

Start with the guide

Follow these steps of the new quickstart guide:

Then go on with the rest of this document.

Make sure to use the appropriate Firebase Sender ID

The previous versions of the WonderPush Android SDK used the push_sender_ids string resource from res/values/string.xml, which defaults to WonderPush's own Sender ID, 1023997258979.
By default, the WonderPush Android SDK v3 uses the Sender ID of the Firebase account that is used by your application by reading the google-services.json file, if available.

Go to your WonderPush dashboard in the Settings / Configuration page, Android app tab and check to see if you have already filled a Server Key.

  • if filled, then you'll need to use the Sender ID corresponding to that Server Key. If in doubt, we can help.
    If it matches the Firebase Sender ID you see in google-services.json, you can stop here.
    Look at your push_sender_ids value, and use that value; if there are 2 values, ignore 1023997258979 and use the other one.
  • if empty, then use 1023997258979 as Sender ID.

Finally, you need to force the Sender ID picked up by the SDK by editing your app/build.gradle file to add the following entry:

android {
    defaultConfig {
        buildConfigField 'String', 'WONDERPUSH_SENDER_ID', '"YOUR_SENDER_ID"'
    }
}

Replace YOUR_SENDER_ID with the Sender ID identified earlier.

Remove unused code

  • Remove the manifest placeholders in your AndroidManifest.xml:
android {
    defaultConfig {
        // You can remove this, it is no longer used
        /*
        manifestPlaceholders = [
                wonderpushNotificationIcon: '@drawable/notification_icon',
                wonderpushDefaultActivity : '.MainActivity'
        ]
        */
    }
}

Now that you have the WONDERPUSH_CLIENT_ID and WONDERPUSH_CLIENT_SECRET build config fields, you can:

  • Remove your WonderPushInitializerImpl class
  • Remove a possible <meta-data android:name="wonderpushInitializerClass" …/> in your AndroidManifest.xml. You would only have this if you changed the class name from the above default.

No need to keep WonderPushInitializerImpl, as most options can now be controlled by configuration options. That said, if you do have a valid use case for the initializer class, keep it as is.

  • Remove calls to WonderPush.initialize(Context) and WonderPush.initialize(Context, String, String). The automatic initialization takes care of this.
    Your Application class may now be empty, feel free to remove it along with its reference in attribute of the <application android:name=".MyApplication"> tag in your AndroidManifest.xml.
    Note that WonderPush.setUserId() is only required when changing logging in or out, the SDK already remembers the latest given value, so you can remove that call there too.
  • Remove calls to WonderPush.showPotentialNotification(). They were only needed for pre Android 14 versions anyway.

  • We've renamed a few methods:

Deprecated method
New method

getInstallationCustomProperties()

getProperties()

putInstallationCustomProperties()

putProperties()

getNotificationEnabled()

isSubscribedToNotifications()

setNotificationEnabled(true)

subscribeToNotifications()

setNotificationEnabled(false)

unsubscribeFromNotifications()

Things are getting a whole lot simpler, don't you feel?

Remove any GcmListenerService

If you used your own implementation of GcmListenerService, you will need to move its onMessageReceived(String, Bundle) implementation to call move it to your FirebaseMessagingService.onMessageReceived(RemoteMessage) implementation.

See Firebase Cloud Messaging setup for Android for more information on how to setup your own FirebaseMessagingService.

public class MyFirebaseMessagingService extends FirebaseMessagingService {

    @Override
    public void onMessageReceived(RemoteMessage remoteMessage) {
        if (WonderPushFirebaseMessagingService.onMessageReceived(this, remoteMessage)) {
            // The notification was handled by WonderPush
        } else {
            // Handle the notification yourself
        }
    }

}

You will also need to update the changes in your AndroidManifest.xml:

<manifest
    xmlns:tools="http://schemas.android.com/tools">

    <application>

        <!-- OLD ENTRIES TO REMOVE -->
        <!--
        <service
            android:name="com.wonderpush.sdk.WonderPushGcmListenerService"
            tools:node="remove"/>
        <service
            android:exported="false"
            android:name="YOUR_CUSTOM_GCMLISTENERSERVICE_CLASS" >
            <intent-filter>
                <action android:name="com.google.android.c2dm.intent.RECEIVE" />
            </intent-filter>
        </service>
        -->

        <!-- NEW ENTRIES TO ADD -->
        <!-- This removes the FirebaseMessagingService provided by the WonderPush SDK. -->
        <service
            android:name="com.wonderpush.sdk.WonderPushFirebaseMessagingService"
            tools:node="remove"/>
        <!-- This registers your own FirebaseMessagingService. -->
        <service
            android:name="MyFirebaseMessagingService">
            <intent-filter>
                <action android:name="com.google.firebase.MESSAGING_EVENT" />
            </intent-filter>
        </service>

    </application>

</manifest>

Remove any InstanceIDListenerService

If you used your own implementation of InstanceIDListenerService, you will need to move its onTokenRefresh() implementation to call move and adapt it to your FirebaseMessagingService.onNewToken(String) implementation.

public class MyFirebaseMessagingService extends FirebaseMessagingService {

    @Override
    public void onNewToken(String token) {
        WonderPushFirebaseMessagingService.onNewToken(this, token);
    }

}

You will also need to update the changes in your AndroidManifest.xml:

<!-- OLD ENTRIES TO REMOVE -->
<!--
<service
    android:name=".MyInstanceIDListenerService"
    android:exported="false">
    <intent-filter>
        <action android:name="com.google.android.gms.iid.InstanceID" />
    </intent-filter>
</service>
-->

And follow the steps in the above Remove any GcmListenerService section to implement your FirebaseMessagingService.

Review if you have any GCM specific code

If you have an advanced integration of notification, it can be a good idea to search for the following strings in your code:

  • com.google.android.gms:play-services-gcm
  • C2D_MESSAGE
  • GcmReceiver
  • com.google.android.c2dm.permission.SEND
  • com.google.android.c2dm.intent.RECEIVE
  • com.google.android.gms.iid.InstanceID
  • InstanceIDListenerService
  • GcmListenerService
  • GcmPubSub

If you found any, follow the GCM to FCM migration guide, as parts of it may apply to you – although most of the work only impacts the WonderPush Android SDK implementation and not your application.

Continue with the guide

You can continue the quickstard guide from the Step 5. Sync Gradle and build to see that everything compiles and runs fine.

Upgrading to Android SDK v3


Suggested Edits are limited on API Reference Pages

You can only suggest edits to Markdown body content, but not to the API spec.