I had a problem. I try to send notification to iOS app with sending post request to https://fcm.googleapis.com/fcm/send
Request:
{
"notification":
{
"body": "test",
"sound" : "default",
},
"data":
{
"id": "",
"type": "",
},
"project_id": "my-app-id",
"registration_ids": [ "6d0a9931d0b5145e69c2aa5402b4acbf46b6da7193c659c5858ff4c3baa417d5" ],
"time_to_live" : 3,
"priority" : "high"
}
and every time I get
responce:
{
"multicast_id": 6755836923824168435,
"success": 0,
"failure": 1,
"canonical_ids": 0,
"results": [
{
"error": "InvalidRegistration"
}
]
}
But when I use NWPusher (https://github.com/noodlewerk/NWPusher) everything is Ok, I get the push notification
image of success sending push notification
Related
I've implemented Silent push notification, but it has a sound like the normal ones. Help me to correctly implement this.
Here's the payload that we're sending from Backend to FCM:
{
"notification": {
"messageId": "24d0f68a24d"
},
"content_available": true,
"data": {
"requestId": "231DDD",
"messageId": "f68a24d",
"event": "REMOVE_NOTIFICATION",
"message": ""
},
"apns": {
"headers": {
"apns-push-type": "background",
"apns-priority": 5
}
},
"to": "FCM_Token",
"priority": "high"
}
To make this silent, you have to remove following part.
"notification": {
"messageId": "24d0f68a24d"
},
I have an in house application where I have the criticalAlert option setup within my application. I have confirmed that when I send the following with the pushy application, I am able to get the Critical Alert to work on the iOS application.
The issue is our internal server currently only sends the notifications to the Firebase Cloud Messaging, and I'm not able to configure the raw push payload to play the critical alert on the device.
Here is the example that Apple gave on how the push should look to APNS:
Here is what I send using the pushy app that works on the application:
{
"aps" : {
"content_available": true,
"priority": "high",
"alert" : "Your message Here",
"badge" : 1,
"sound": {
"critical": 1,
"name": "alert.wav",
"volume": 1.0
},
"data": {
"volume": 7,
"time_to_live": 900,
"id": 3618,
"type": "engagement",
"overrideMessage": "Testing oncall for iOS",
"case": "Test Case",
"repeatNumber": 3,
"customer": "Google"
}
}
}
Here is the current payload that we send to FCM and it works with the custom sound, but we really want the critical alert to be working since the push is for an on-call engagement:
{
"to": "firebaseToken",
"content_available": true,
"priority": "high",
"isCritical": "true",
"notification": {
"title": "Title in notification",
"body": "Body in notification",
"sound": "alert.wav",
"badge": "1",
"subtitle": "subtitle in notification"
},
"data": {
"volume": 7,
"time_to_live": 900,
"id": 3618,
"type": "engagement",
"overrideMessage": "Testing oncall for iOS",
"case": "Test Case",
"repeatNumber": 3,
"customer": "Google"
}
}
I have tried a large number of combinations on what to send to FCM but with no luck:
{
"to": "firebaseToken",
"apns": {
"headers": {
"apns-priority": "10"
},
"payload": {
"aps" : {
"sound": {
"critical": 1,
"name": "alert.wav",
"volume": 0.5
},
and
{
"aps" : {
"to": "firebaseToken",
"content_available": true,
"priority": "high",
"alert" : "Your message Here",
"badge" : 1,
"sound": {
"critical": 1,
"name": "alert.wav",
"volume": 0.5
},
and
{
"to": "firebaseToken",
"aps" : {
"sound" : {
"critical": 1,
"name": "alert.wav",
"volume": 1.0
}
},
"notification": {
"badge": "1",
and
{
"to": "firebaseToken",
"isCritical": "true",
"content_available": true,
"notification": {
"badge": "1",
"sound" : {
"critical": 1,
"name": "alert.wav",
"volume": 1.0
},
None of them have allowed the sound dictionary to be passed on to FCM.
I have also the the answer here but it doesn't solve my problem. as I require iOS to know that this push notification is critical and have the OS handle it and not my application.
Before I give the answer to your specific question, I'd like to recommend that you consider using the Admin SDK instead of the REST API if possible. The SDK is available in Node.js, Java, python, go, and C#. If your server code is written in any of those languages, this is a much simpler way to handle sending messages with FCM. The SDK handles retries and other scenarios you would otherwise have to implement into your code.
As for your question, it's noted in the guides that platform-specific fields only work with the FCM v1 endpoint. To use FCM, your endpoint will look like this:
https://fcm.googleapis.com/v1/projects/[your-project-id]/messages:send
You can see an example of this in the guides. Select REST from the snippet tab to see the example.
Note that the way you authorize sends is different with V1. You can find out more in the guide. If you have trouble with the auth part, I also wrote a blog post about it since it comes up pretty regularly.
I am trying to send push notifications for offline users, but it is not sent to the device
Environment details:
ios chat app, I am using latest version from cocoapods
Expected behavior: It should show push notifications on the device
Actual behavior
I have uploaded the certificate,
it is showing valid
I have checked my device udid in subscription, it is showing my device udid
The sent notification also shows in queue on quickblox here is the log of sent push, it shows NULL in delivered and there is no error
{
"notification": {
"id": 15460780,
"badge": 45,
"device_token": "0780db28ac60e37390e067f5b1d88688d804f594152827b1b28f86e670669530",
"sound": "default",
"alert": "Test User: Hello",
"data": {
"dialog_id": "5b3b4b9ba0eb474bbc0244eb",
"user_id": 53886466,
"message_id": "5b3b6a6b2d3084b447b7ad3d",
"badge": 45,
"headers": {
"apns-topic": "com.company.app"
},
"__rpush_content_available__": true,
"__rpush_mutable_content__": true
},
"expiry": 86400,
"delivered": false,
"delivered_at": null,
"failed": false,
"failed_at": null,
"fail_after": "2018-07-03T13:22:05+00:00",
"retries": 118,
"error_code": null,
"error_description": null,
"deliver_after": "2018-07-03T12:31:57+00:00",
"alert_is_json": null,
"app_id": 23880,
"collapse_key": null,
"delay_while_idle": null,
"registration_ids": null,
"uri": null,
"priority": null,
"url_args": null,
"category": null,
"content_available": false,
"mutable_content": false,
"notification": null,
"type": "Rpush::Client::Redis::Apns::Notification",
"event_id": 24743581,
"event_date": "2018-07-03T12:22:05+00:00"
},
"log": [
{
"device_token": "0780db28ac60e37390e067f5b1d88688d804f594152827b1b28f86e670669530",
"delivered_at": null,
"failed_at": null,
"error_code": null,
"error_description": null
}
]
}
Also i have tried sending push through third party (pushtry.com) with same certificates and it is sending push but with quickblox, it is not showing any push notification
Looks like it is Quickblox server-side issue. Probably they haven't adjusted the server in appliance with recent changes in APNS. I asked their support, but they do not answer.
json push notifciation for apple payload should be in below format
{
"aps": {
"alert": "Hello World",
"sound": "default"
},
"Person": {
"Address": "this is a test address",
"Name": "First Name",
"Number": "023232323233"
}
}
I created silent push notifications with Pusher that works with that JSON:
{
"aps" : {
"content-available" : 1
},
"acme1" : "bar",
"acme2" : 42
}
What is important here is the content-available to 1 to get it.
My problem now, is to use it in AeroGear UnifiedPush Server & Docker, but when I construct my JSON, I cannot put that keys.
I tried this without success:
curl -u "c94ab6da-17e1-4c35-b17f-1ab482152a65:57781ef0-9105-440d-b902-217461c0e743" -v -H "Accept: application/json" -H "Content-type: application/json" -X POST -d '{
"message": {
"alert": "Hello from the curl HTTP Sender!","content-available": true
}}' http://localhost:18081/rest/sender
It returns me an error:
Unrecognized field "content-available" (class org.jboss.aerogear.unifiedpush.message.Message), not marked as ignorable
Documentation
How to send Push Notifications in iOS with AeroGear UnifiedPush Server?
You should add apns object to your JSON. A complete message sample is as follow :
{
"message": {
"alert": "HELLO!",
"sound": "default",
"badge": 2,
"consolidationKey": null,
"priority": "normal",
"windows": {
"type": "tile",
"duration": null,
"badge": null,
"tileType": "TileWideBlockAndText01",
"toastType": null,
"images": [
],
"textFields": [
],
"page": "/MainPage.xaml"
},
"apns": {
"title": null,
"action": null,
"action-category": "some value",
"url-args": null,
"content-available": true,
"mutable-content": false,
"localized-key": null,
"localized-arguments": null,
"localized-title-key": null,
"localized-title-arguments": null
},
"user-data": {
"key2": "other value",
"key": "value"
},
"simple-push": "version=123"
},
"criteria": {
"categories": [
"someCategories"
],
"variants": [
"someVariantIDs"
],
"alias": [
"someUsername"
],
"deviceType": [
"someDevice"
]
},
"config": {
"ttl": 3360
}
}
You can test it with your curl command.
Hi I am developing ionic app for android and IOS but I am facing issue with push notification. My notification status as below
"data": [
{
"config": {
"query": {
"$and": [
{
"details.email": {
"$regex": "prit"
}
}
]
},
"notification": {
"title": "Test Push",
"payload": {},
"android": {
"title": "Test Push",
"priority": "high",
"message": "Get 150% off!cxzczxcxzc"
},
"ios": {
"title": "Test Push",
"priority": 10,
"message": "Get 150% off!cxzczxcxzc"
},
"message": "Get 150% off!cxzczxcxzc"
},
"profile": "dev"
},
"created": "2017-03-07T10:19:07.563387+00:00",
"status": "locked",
"uuid": "82a2a7be-b7ad-41c3-abca-d5243b040c76",
"state": "enqueued",
"app_id": "1e54f22e"
},
],
"meta": {
"version": "2.0.0-beta.0",
"status": 200,
"request_id": "d70268c5-3875-4e78-cef6-a17927b04917"
}
}
here state is in enqueued ("status": "locked") and "status": "locked",.
I am not understanding its meaning. due to this I am not able to receive the any push notification. Please let me know how I can resolve this issue.