Android Question Push notification from wordpress to Android e iOS using firebase

DonManfred

Expert
Licensed User
Longtime User
Implement Firebase Notifications

 
Upvote 0

Nino Caminiti

Member
Licensed User
You don't need to insert rest API in client apps.
Are you having problem receiving the notifications from Android or iOS apps?
You don't need to insert rest API in client apps.
Are you having problem receiving the notifications from Android or iOS apps?
Hi, I can make push notifications from firebase console... But I would like to push directly from word press each time that I will publish a post.. I have downloaded the following WordPress plugin: https://es.wordpress.org/plugins/push-notification-fcm/... These are the instructions :

Descripción​

A very simple plugin for the Firebase Cloud Messaging (FCM) system that enables simple push notifications to all Android and iOS devices around the world.

EASY INTEGRATION AND USE​

Simply, you install the plugin, enter your Firebase Server (API) key in the plugin settings, generate a site key and choose the types of posts for which you want to push a notification.
Then you need to insert the generated REST endpoints of your site in your mobile application.
These endpoints are used to register the device with the site when the application is launched and deregister the device when the user deletes the application.
After device registration, every time a new article or page is published in the selected post types, all registered devices are notified and a notification appears.

If it is possible with b4a and b4i?
 
Upvote 0

aeric

Expert
Licensed User
Longtime User

REST API ENDPOINTS​

In order to be able to send push notifications, you need to record the device ID and device token in the site’s database. Therefore, you have 2 REST endpoints to subscribe the device when the application is installed or launched, and unsubscribe the device during app deletion.

Subscribe device:


Parameters:

  • rest_api_key (required) – Unique generated site key provided by the plugin
  • device_uuid (required)
  • device_token (required)
  • subscription (required) – This would be the some category name in which the device is registered, if there is no category exists in WordPress it’ll be created automatically.
  • device_name (optional)
  • os_version (optional)
Returns JSON:

{
"error": false,
"message": "Device token registered",
"subscription_id": 123
}


So you need to call the subscription URL https://example.domain/wp-json/fcm/pn/subscribe from B4A or B4i app using okHttpUtils2.
It doesn't mention to use GET or POST, so you can try with GET using job.Download or job.Download2.
 
Upvote 0
Cookies are required to use this site. You must accept them to continue using the site. Learn more…