
To enable push notifications in the mobile application you need to create an account in Firebase, for this example we'll use Plaspy basic mobile application and add push notifications through Firebase
To enable push notifications in the mobile application you need to create an account in Firebase https://firebase.google.com/
After building the basic mobile application based on Cordova
-
Add Firebase to the previously created mobile application
https://firebase.google.com/docs/android/setup
https://firebase.google.com/docs/ios/setup -
Built the Android or iOS project in Firebase
https://firebase.google.com/docs/android/setup#create-firebase-project
https://firebase.google.com/docs/ios/setup#create-firebase-project -
Register your application with Firebase
https://firebase.google.com/docs/android/setup#register-app
https://firebase.google.com/docs/ios/setup#register-app -
Add a Firebase configuration file
https://firebase.google.com/docs/android/setup#add-config-file
https://firebase.google.com/docs/ios/setup#add-config-file
To add our mobile service settings the following files are required in the mobile application
Android: google-services.json
iOS: GoogleService-Info.plist
-
After adding the Firebase base libraries it is necessary to add the messaging client libraries
https://firebase.google.com/docs/cloud-messaging/android/client
https://firebase.google.com/docs/cloud-messaging/ios/client -
To make the mobile application communicate with Plaspy it is necessary to add the Cordova Plugin in Plaspy which is called PlaspyPlugin we find it in the example code in the application.
Modify the config.xml file of the mobile application to add the Plugin
Android<feature name="PlaspyPlugin">iOS
<param name="android-package" value="com.plaspy.test.PlaspyPlugin" />
</feature><feature name="PlaspyPlugin">
<param name="ios-package" value="PlaspyPlugin" />
</feature> -
In the same config.xml file we modify the content section to replace the line
<content src="https://m.plaspy.com/m/Index?lcl=1" />by<content src="https://m.plaspy.com/m/Index?pumvcv=5" />
To test that the Plaspy plugin works correctly we can do it at the URL https://m.plaspy.com/m/MobileAppTest/Index?pumvcv=5 from the mobile application to do this we change in the config.xml file the previous line of content to
<content src="https://m.plaspy.com/m/MobileAppTest/Index?pumvcv=5" />
To activate the Push notifications in Plaspy, go to the Settings under "Advanced Customization", "Mobile Push Notifications" and copy the private key generated by Firebase. In Firebase Account key, copy the content of the JSON file containing the private key.
To get our private key for sending Push Notifications in Firebase we follow the instructions of https://firebase.google.com/docs/admin/setup#initialize_the_sdk
To test that the key works properly we can use the token of our test device (Push notifications only work on a device and not on the emulator)
https://firebase.google.com/docs/cloud-messaging/android/client#sample-register
https://firebase.google.com/docs/cloud-messaging/ios/client#fetching-the-current-registration-token
Índice
- Welcome to Plaspy help
- Map
- Reports
- Left panel
- Show Route
- GeoFences
- Alerts
- Mileage Calculation
- Atributes
- Enable map notifications
- Statistics
- Devices
- Alerts
- Enable Telegram notifications
- Email alerts sending limits
- Groups
- Share Access
- Users
- Settings
- SMS
- Activation Code
- Line Renewal
- Points redemption
- Developers
- API Activation
- Rest API
- Authentication
- Devices
- Device
- Last Location
- Locations
- Alerts
- Embed on my website
- Embed the map on my website
- Mobile App
- Advanced Mobile App
- Mobile application with push notifications
- API (Obsolete)
- Operations and results
- Format of requests and responses
- Example
- Sample Codes
Questions
We answer all support request within 24 business hours approximately, If you have a question that needs an immediate resolution, please contact us by other way.
We answer you in business hours, as soon as possible. We are located in Bogotá, Colombia, time zone (GMT-5).