Sometimes while you're trying to send pushes, you may come across a problem which could prevent the process from completing.
Firstly, we recommend you follow the Back4App Official Documentation which contains the steps to configure the Push Notification to Android (click here). If you are still not able to receive the push, in this article, we will include some tips that should help you to solve with these tips. Check the topics below:
1. Link your Firebase Project with Back4App
1. 1. Go to Back4App Push Notification Doc and follow the Step 1 to create a Firebase Project.
1. 2. Then, go to Back4App Website, log in, find your app and click on Server Settings. Find the “Android Push notification” block and click on SETTINGS > EDIT. Copy the Server Key and paste it at the API Key field shown in the Back4App Android Push Notification page you visited. Do the same thing with the Sender ID, copy and paste it at the GCM Sender ID field.
2. Download google-services.json
Now, you have to download the google-services.json file and move it to your Android Studio project inside app directory.
3. Configure your AndroidManifest.xml
<meta-data
android:name="com.parse.SERVER_URL"
android:value="@string/back4app_server_url" />
<meta-data
android:name="com.parse.APPLICATION_ID"
android:value="@string/back4app_app_id" />
<meta-data
android:name="com.parse.CLIENT_KEY"
android:value="@string/back4app_client_key" />
<meta-data
android:name="com.parse.push.gcm_sender_id"
android:value="id:PASTE_HERE_YOUR_GCMSenderId" />
Check out the complete AndroidManifest.xml file with the Firebase and Parse Server Android SDK configuration. Click here.
4. Configure your App.java or Main activity
Parse.initialize(new Parse.Configuration.Builder(this)
.applicationId(getString(R.string.back4app_app_id))
.clientKey(getString(R.string.back4app_client_key))
.server("https://parseapi.back4app.com/")
.enableLocalDataStore()
.build());
Parse.setLogLevel(Parse.LOG_LEVEL_VERBOSE);
ParseInstallation installation = ParseInstallation.getCurrentInstallation();
installation.put("GCMSenderId", "PASTE_HERE_YOUR_GCMSenderId");
installation.saveInBackground();
The deviceToken is generated by the Parse Server SDK when the application is successfully installed on the device( you don't have to manually configure it in your project).
5. Required fields
To send pushes via Dashboard, you need to have GCMSenderId, deviceToken and installationId fields configured.
You are also able to download our Github project and replace your keys to check it working:
Note: Please, don't forget to replace with your google-services.json file.
Did you run the tests and it's not working yet? Please contact us anytime, we will specifically check your case!
Comments
0 comments
Please sign in to leave a comment.