WordPress Plugin FCM(Firebase Cloud Messaging) for Android
- URL : www.sample-domain.com/?api-fcm=register
- TYPE : POST
- HEADER : Content-Type : application/json
- BODY :
{
"regid": "APA91bHScXXXXXXXX",
"serial": "Android device serial number D511E1ZR611XXXXX",
"device_name": "Brand Name (samsung SM-XX, Sony D-XXX, etc)",
"os_version": "5.0 or 4.1 etc"
}
- RESPONS :
{
"status": "success or failed",
"message": "Message Content"
}
this article may help you :
- http://blog.dream-space.web.id/?p=116
- https://firebase.google.com/docs/cloud-messaging/android/client
- JSON
{
"title": "Title Text",
"content": "Content Text",
"post_id": post_id in number (optional)
}
- Android
@Override
public void onMessageReceived(RemoteMessage remoteMessage) {
if (remoteMessage.getData().size() > 0) { // validate nullable
Map<String, String> data = remoteMessage.getData();
String title = data.get("title");
String content = data.get("content");
Integer post_id = Integer.parseInt(data.get("post_id")); // can be null
// Your action display notification here
}
}
https://codecanyon.net/item/koran-wordpress-app-with-push-notification-20/17470988