What are we going to build?
In this tutorial, you’ll learn how to build a mobile app that sends/retrieves push notifications.
Before you begin
- Tutorial level: beginner; your first mobile app.
- Prerequisites: an Appery.io account.
Creating a new app
Apps page in the builder, click
Create new app, enter an app name, and click Create.
1. Open the
Push Notifications tab from the
2. Check the
Enable push notifications check box.
3. In the
Push Settings section, check all the three items:
This means that all of the above will occur when a new push notification arrives. For example, checking the
Push sound option will make a sound, and
Badge will show the number of unread notifications.
Configuring the device
Depending on your device and OS, you’ll have to initialize Android settings, iOS settings, or both.
The next steps show you how to use the Google Developers Console.
1. Go to https://code.google.com/apis/console/ and sign in.
9. Click Go to Credentials.
That’s it for Android configuration.
To enable push notifications for an iOS app, you must have a Development Certificate if your app is registered in Development mode, and a Production Certificate if your app is registered in Distribution mode.
Pages > startScreenand open the
Production, if the application is in the Distribute stage, otherwise leave it unchecked.
- Upload a Push Certification file in Apple Developer portal.
- For generating a Push Notification Certificate, you need to open the
App Idspage, find the desired App ID, click
Configure, and check the
Enable for Apple Push Notification servicecheckbox. Then, click
Configure(select either Development or Production stage):
- Fill the Certificate password that was specified during p12 certificate creation.
That’s it for iOS configuration.
- The Bundle ID shouldn’t have a wild card character, otherwise you can’t configure push notification properties.
- After you have defined the push settings, save the project and check whether the push data was saved correctly.
Linking to the database
Information about the devices on which the app is installed will be saved in the
Devices collection of the selected database, as soon as the device is running the app. If you don’t have a database, create one (see Databases to learn how) and then link the app to it. You only need to link your app with the database once. As soon as they’re linked, the app will open upon clicking
Once the database obtains the registered devices’ data, you can send push notifications.
To learn more about how to register devices, please see this section.
Sending push notifications
To send the notification to the channel:
2. Go to the
Send push notification tab, set the
Expiration date for your push (if necessary) and select the devices. You can select all devices, or use a query string or query builder (for more information read push overview).
3. Specify the
Sound file to be sent with the push (read here for how to set a custom sound alert), define the
Title for your push (
Badge – the number shown with app icon, only in iOS. These are optional parameters; for example, if the
Badge field is empty, the badge will not be changed on a device).
5. Click Send.
You can find detailed documentation about push notifications here.