Batch Android apps
Step-by-step instructions to migrate your Android app from Batch to WonderPush
Migrating to WonderPush is easy: all you have to do is add WonderPush to your app and publish a new version to Google Play.
Users that install this new version can be reached via WonderPush and the others via Batch without risking to send duplicate messages.
This guide will help you remove Batch from your app and add WonderPush.
WonderPush and Batch SDKs expect different push notification formats, so importing your Android push tokens into WonderPush is not very useful. Instead, just let users install the new version of your app and automatically migrate to WonderPush.
Shipping WonderPush in a new version of your app
Step 1. Removing Batch gradle entries
Open your app/build.gradle
and remove the dependency you added during the Batch setup.
implementation 'com.batch.android:batch-sdk:1.13+'
Step 2. Remove Batch code from your app
Open your ApplicationClass
and remove the Batch
initialization snippet:
// Remove the 3 following lines
import com.batch.android.Batch;
import com.batch.android.BatchActivityLifecycleHelper;
import com.batch.android.Config;
public class YourAppClass extends Application {
@Override
public void onCreate() {
super.onCreate();
// Remove the 2 following lines
Batch.setConfig(new Config("YOUR_BATCH_API_KEY"));
registerActivityLifecycleCallbacks(new BatchActivityLifecycleHelper());
}
}
// Remove the 3 following lines
import com.batch.android.Batch
import com.batch.android.BatchActivityLifecycleHelper
import com.batch.android.Config
class YourAppClass : Application() {
override fun onCreate() {
super.onCreate()
// Remove the 2 following lines
Batch.setConfig(new Config("YOUR_BATCH_API_KEY"))
registerActivityLifecycleCallbacks(new BatchActivityLifecycleHelper())
}
}
Also remove any other code that calls the Batch
library within your entire app's codebase.
Step 3. Enter your Firebase credentials into WonderPush
Find your Firebase credentials on the Batch dashboard by going to Settings / Push Settings. Take note of the Firebase Sender ID, we'll use it later when we add WonderPush to your app.
Go to your WonderPush dashboard in Settings / Configuration / Android app and enter the Firebase Server Key from Batch in the Firebase FCM Server Key field:
Step 4. Add WonderPush
Follow our Android Quickstart guide to add WonderPush to your app.
The Firebase sender ID mentioned in the Android Quickstart guide is the one you've noted in Step 3 of the present document. You should skip the step where you fill the Firebase credentials in the dashboard, as we've already done it in Step 3.
Once you've got WonderPush in your app, publish a new version. Users that update their app will automatically appear in your WonderPush dashboard.
That's it!
Once you publish this new version of your app, users will start to show up automatically in your WonderPush dashboard.
Updated over 3 years ago