If you would like to upgrade to a newer long-term support version of Studio Pro, see Moving from Mendix Studio Pro 8 to 9.
Set Up Hybrid Push Notifications
Introduction
In this how to we will set up hybrid push notifications.
This how-to teaches you how to do the following:
- Customize your hybrid template to enable push notifications
Prerequisites
Before starting this how-to, make sure you have completed the following prerequisites:
Building Your Mobile Application
If your app supports push notifications, you are required to set up a Firebase account for your app and include Google service description files (google-services.json and GoogleService-Info.plist) in your hybrid app.
As a result of this, Mendix hybrid apps that employ push notifications can no longer be built directly using the PhoneGap Build flow in the Mendix Portal. Instead, you will need to prepare the hybrid app package locally. You can use the generated hybrid app package to build your Android and iOS apps locally, or upload them to PhoneGap Build manually.
To build the hybrid app package, follow these steps:
-
Open your app in Apps. In the navigation pane on the left, click Mobile App.
-
Make sure the Push Notifications permission is selected under Permissions.
-
Click Publish for Mobile App Stores:
-
Select Do it yourself and then click Download Customizable Package:
This package you just downloaded is a customizable hybrid app package for your specific Mendix app. You can make changes to it, build a new PhoneGap Build package, and then upload it to PhoneGap Build to create the binaries (.apk for Android and .ipa for iOS). To better understand the structure of what you just downloaded, see the Folder Structure section in the Mendix PhoneGap Build App Template documentation.
-
Unzip the hybrid app package.
-
Copy and paste the google-services.json and GoogleService-Info.plist config files you downloaded before into the
config
folder.Only paste the GoogleService-Info.plist config file when you plan on using FCM for sending push notifications to iOS devices. If you plan on keeping using APNS to send push notifications to iOS devices, do not paste the GoogleService-Info.plist config file. -
Create the PhoneGap Build package by following the instructions in the Through Uploading to PhoneGap Build section of the Mendix PhoneGap Build App Template documentation. Be sure to read the Prerequisites and Build on PhoneGap sections of this documentation as well. This is an overview of the steps:
- Install the latest stable version of Node.js.
- In the unzipped hybrid app package folder, execute
npm install
. - In the same folder execute
npm run package
.
- Install the latest stable version of Node.js.
-
Create an APK or iOS package from the PhoneGap Build package. You can upload the new PhoneGap Build package (in the dist folder) to PhoneGap to build the APK or iOS binary.