Android
Push Notifications
from client side
9 min
send parse push notifications from client side introduction client push is a feature that is available on back4app’s parse api, however it is not enabled by default due to security issues enabling client push and allowing your app to use its features is quite simple, but not encouraged the main function of client push is for debugging and test purposes in this tutorial an example app will be built and this is how it will look like at any time, you can access the complete android project built with this tutorial at our github repository prerequisites to complete this tutorial, we need android studio an app created on back4app note follow the new parse app tutorial to learn how to create a parse app on back4app an android app connected to back4app note follow the install parse sdk tutoria l to create an android studio project connected to back4app a device (or virtual device ) running android 4 0 (ice cream sandwich) or newer 1 enable client push go to back4app website , log in, find your app and click on server settings server settings find the “core settings” block and click on settings settings the “core settings” block looks like this 3\ scroll to the end of the page and click on the edit details edit details button, as shown below 4\ you will see a checkbox called allow push notification from client in the end of the edit page, tick that box and click on the save button, as shown below 2 push from your app at the beginning of your activity, import the following dependencies 2\ use parsepush parsepush to send the push message, as shown in the following code remember to set up the channels and the message 1 jsonobject data = new jsonobject(); 2 // put data in the json object 3 try { 4 data put("alert", "back4app rocks!"); 5 data put("title", "hello from device"); 6 } catch ( jsonexception e) { 7 // should not happen 8 throw new illegalargumentexception("unexpected parsing error", e); 9 } 10 // configure the push 11 parsepush push = new parsepush(); 12 push setchannel("news"); 13 push setdata(data); 14 push sendinbackground(); 3\ to test the push notifications, just call that function while the device is opened it’s done! at this stage, you can send push notifications using your own device with client push through back4app! to learn more about android push notification, see parse android push notification official documentation