Ionic not sending push notification - android

I'm using ngCordova cordovaPushV5 and when I open the app I get the registration id just fine, but when I send the notification via POST request using Postman I do not get a notification on the device.
Here is the curl request I'm trying:
curl -X POST -H "Authorization: Bearer MY_API_TOKEN" -H "Content-Type: application/json" -d '{
"tokens": ["dO-ocODiZSE:APA91bFTEvGakImDE3Jk-qhYyGwl86qq4R8bQuKikaQeyeYmDkaxWjMZTv47SmX0rvYUWLjpeG24LsQYIuE2KJA0I4U9Hq-2HyG9LuST3jn5SwLc1FTYQbyttIuKaGKHMDMTIaTdLyIx"],
"profile": "trader_mobile",
"notification": {
"message": "Test"
}
}' "https://api.ionic.io/push/notifications"
And this is the response I get:
{
"meta": {
"request_id": "5ac67cae-458e-4ff4-aa9a-ac86f4aff873",
"version": "2.0.0-beta.0",
"status": 201
},
"data": {
"app_id": "de12c106",
"status": "open",
"config": {
"profile": "trader_mobile",
"tokens": [
"dO-ocODiZSE:APA91bFTEvGakImDE3Jk-qhYyGwl86qq4R8bQuKikaQeyeYmDkaxWjMZTv47SmX0rvYUWLjpeG24LsQYIuE2KJA0I4U9Hq-2HyG9LuST3jn5SwLc1FTYQbyttIuKaGKHMDMTIaTdLyIx"
],
"notification": {
"message": "Test"
}
},
"uuid": "7efef50c-72bf-4e08-a176-4c28de8b2258",
"state": "enqueued",
"created": "2016-09-05T17:00:46.425695+00:00"
}
}
But I still do not receive the notification on the device.
I've set up my gcm api key in my security profile in my Ionic Dashbaord, and uploaded my app with ionic upload and did ionic io init. I've tried every solution I could find, and I've tried just about every command in different orders. As well as removing the platform and adding it again. Still nothing, what am I doing wrong?

Related

Share link from app doesnt work - universal ios expo

im trying to implement universal links, but i cant not get it work, im using expo managed workflow, so heres the app.json config:
"expo": {
"scheme": "myapp",
"ios": {
"associatedDomains": ["applinks:myapp"],
}
},
so the scheme is for example is myapp and my server where is the well-known file is also https://myapp
here is the well-known-file:
{
"applinks": {
"apps": [],
"details": [
{
"appID": "TEAM_ID.BUNDLE_IDENTIFIER",
"components": [
{
"/": "/*",
}
]
}
]
},
"activitycontinuation": {
"apps": [
"TEAM_ID.BUNDLE_IDENTIFIER"
]
},
"webcredentials": {
"apps": [ "TEAM_ID.BUNDLE_IDENTIFIER" ]
},
"appclips": {
"apps": ["TEAM_ID.BUNDLE_IDENTIFIER"]
}
}
everytime i enter to the page or enter that direction in safari it doesnt detect the app, BUUUUT if i do: myapp:// in safari it will ask me if i want to open it in the app, why using the scheme it works? and using https doesnt, need to share it with https so android users can open the app when click on it

React Native Firebase Push Notification not getting received in Release Build

Please guide me to get it resolved please.
I have installed below npm packages to integrate firebase push notification.
"#react-native-firebase/app": "^8.4.5",
"#react-native-firebase/messaging": "^7.9.0",
I receive notification in debug mode but if i release the build notification is not working at all.
Here is payload i am using -
{
"notification": {
"title": "notification title",
"body": "notification is ready.",
"click_action": null,
"icon": null
},
"data": {
"xyz":"test",
"click_action": null
},
"to":"xxxxxx",
"content_available": true
}

How to send image using push notification?

How to send push notification with the image using FCM, I have used below things but still just getting only title and text in the notification.
I have used cordova based hybrid application. If anyone has any idea, please let me know.
Sample curl code:
curl https://fcm.googleapis.com/fcm/send -X POST \
--header "Authorization: key=<AUT KEY>" \
--Header "Content-Type: application/json" \
-d '
{
"to": "<to TOKEN>"
"notification":{
"title":"New Notification!",
"body":"Test",
"color":"#ff0000",
"icon":"noti_icon",
"img_url": "https://static.pexels.com/photos/4825/red-love-romantic-flowers.jpg",
"image" : "http://cernyyachtdesign.com/wp-content/uploads/png-test.png",
"avatar_url" : "http://cernyyachtdesign.com/wp-content/uploads/png-test.png",
"url" : "http://cernyyachtdesign.com/wp-content/uploads/png-test.png",
"image_url" : "http://cernyyachtdesign.com/wp-content/uploads/png-test.png",
"largeIcon":"http://cernyyachtdesign.com/wp-content/uploads/png-test.png",
},
"data" : {
"img_url": "https://static.pexels.com/photos/4825/red-love-romantic-flowers.jpg",
"image" : "http://cernyyachtdesign.com/wp-content/uploads/png-test.png",
"avatar_url" : "http://cernyyachtdesign.com/wp-content/uploads/png-test.png",
"url" : "http://cernyyachtdesign.com/wp-content/uploads/png-test.png",
"image_url" : "http://cernyyachtdesign.com/wp-content/uploads/png-test.png",
"message": "Firebase Push Message Using API",
"largeIcon":"http://cernyyachtdesign.com/wp-content/uploads/png-test.png",
"main_picture":"http://cernyyachtdesign.com/wp-content/uploads/png-test.png",
},
"priority":1
}'
Thanks.
Finally after 2 days suffer, I got solution to display all types of notification in cordova application.
Plugin Details: https://github.com/phonegap/phonegap-plugin-push
Make sure you have to remove cordova-plugin-firebase if you want to user above plugin, else it will conflict with each other.
For more detail please check above git link which have detail flow of this plugin. I have tested it on android#8.0.0

mattermost-push-proxy not fire push notification

I've been trying to configure push-proxy on my server.i have done complete installation from here
mattermost-push-proxy
After installation my server is running but when i want to test notification from curl
curl http://172.104.182.36:8066/api/v1/send_push -X POST -H "Content-Type: application/json" -d '{ "message":"test", "badge": 1, "platform":"android", "server_id":"c5brhfxaeb8o3qkcc3dfc47coy", "device_id":"android:el99uTDjv0A:APA91bGnVbuZl9W2lQSSokXYECVa4Tgt-wrnOxQFh4r51pzdDaFxbXUrJXQgmcSaPYToyIA5Dc9CCLPvYPNBF8bnrZdCjOSIaJmgB0Uhusj-8IoVCtFfAkF_l_PfRq0TMQf7L_RYMLqo"}'
I got this error:
{"error":"unknown transport error","status":"FAIL"}
please help me.
thanks
First ensure that your config file has the appropriate certificates and ApiKeys like:
{
"ListenAddress":":8066",
"ThrottlePerSec":300,
"ThrottleMemoryStoreSize":50000,
"ThrottleVaryByHeader":"X-Forwarded-For",
"EnableMetrics": false,
"ApplePushSettings": [
{
"Type" : "apple_rnbeta",
"ApplePushUseDevelopment": false,
"ApplePushCertPrivate": "./config/aps_rnbeta_production_priv.pem",
"ApplePushCertPassword": "",
"ApplePushTopic": "com.mattermost.rnbeta"
},
{
"Type" : "apple",
"ApplePushUseDevelopment": false,
"ApplePushCertPrivate": "./config/aps_rn_production_priv.pem",
"ApplePushCertPassword": "",
"ApplePushTopic": "com.mattermost.rn"
}
],
"AndroidPushSettings": [
{
"Type" : "android_rn",
"AndroidApiKey": "AIzaSyA1sl9LXXXxXXXxXXXxXXXxX_XXXXXX"
},
{
"Type" : "android",
"AndroidApiKey": "AIzaSyA1sl9LXXXxXXXyXXXxXXXyX_XXXXYY"
}
]
}
That being said just because you are using your own push-proxy server you need to build and compile the apps yourself so that the above certificates and Android ApiKeys match with your registered device tokens.
when building the app yourself don't forget to change the bundleId on iOS and packageId on Android so they also match with your certificates and keys.

Ionic push - GCM_INVALID_AUTH

I'm developing an Ionic (version 1.3.1) application and trying use Ionic push.
The application is correctly registering to ionic server but I still don't receive any notification in my device. The only error I get is the below notification status:
{
"notification": "808cde89-eb21-40d7-9999-b86e5f86f1d3",
"token": {
"type": "android",
"token": "dkYxYGcKeNo:APA91bE4OXhzkOUOSF1EsXxgY9Cd0Uu9-A98Ak5prdMIGUd10tLljacgKs7zAp1WPLF-bDiy3pkdroc9l8vWy4sXdfansr56-rIF59wJfR1e7EibJZHFO5DFxCThpT_ZgVn_T_0n8an1",
"id": "ea40d3bc7561cc4f0d28ac49ce87fd3a",
"app_id": "7ab91503",
"invalidated": null,
"created": "2016-09-17T11:31:53.481151+00:00",
"valid": true
},
"uuid": "0ebe9454-aebc-4c0b-b5b0-056920817f56",
"status": "error",
"error": "GCM_INVALID_AUTH",
"created": "2016-09-17T14:31:20.517783+00:00",
"user_id": null
}
I'm supposing ionic server is not sending the notification to device as the status is error, but I don't know the reason why I'm getting this GCM_INVALID_AUTH error. What could cause this problem?
You need migrate your project from GCM to FCM (firebase cloud message) , and use new server key.
SOLVED
I was using the wrong credentials from Google Cloud Platform. When I set to server key the problem was solved.

Categories

Resources