React Native Firebase Push Notification not getting received in Release Build - android

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
}

Related

Expo push notifications working on expo go but not working on apk ( production )

I'm trying to implement expo push notification ! I did everything as the docs say.
Created a firebase project and downloaded the google-services.json and uploaded the server key on the cloud messaging to expo servers using expo push:android:upload --api-key <your-token-here> ! so basically I did everything mentioned on their docs! My notifications works perfectly fine when I test it on the Expo GO ! but after I built an apk using eas build -p android --profile preview
The notification doesn't pop up! the api that I send from says that the notification was sent but it doesn't show on the device!
I read that notifications work on expo go and not apk because of the credentials! did I miss a step or something?
When I go to the expo builds and go to the project credentials Two options pop up, One by the path of com.company.app and the other one : by Legacy ( classic build)!
app.json
{
"expo": {
"name": "myapp",
"slug": "myapp",
"version": "1.0.0",
"orientation": "portrait",
"icon": "./assets/icon.png",
"userInterfaceStyle": "light",
"splash": {
"image": "./assets/splash.png",
"resizeMode": "contain",
"backgroundColor": "#ffffff"
},
"updates": {
"fallbackToCacheTimeout": 0
},
"assetBundlePatterns": ["**/*"],
"ios": {
"supportsTablet": true
},
"android": {
"googleServicesFile": "./google-services.json",
"adaptiveIcon": {
"foregroundImage": "./assets/adaptive-icon.png",
"backgroundColor": "#FFFFFF"
},
"package": "com.hyrix.myapp",
"useNextNotificationsApi": true
},
"web": {
"favicon": "./assets/favicon.png"
},
"extra": {
"eas": {
"projectId": "ee001501-c3b5-402f-8a1d-914144496965"
}
}
}
}
You could check the Android Studios's logcat after connect your android smartphone to your PC.
I've tried to debug the app in Android Studio's logcat and got the following error message:
'[expo-notifications] Error encountered while updating the device push token with the server:', '{"errors":[{"code":"VALIDATION_ERROR","message":"\"appId\" must be a string.","isTransient":false}]}'
What I did to solve this issue was set "applicationId" manually in the Notifications.getExpoPushTokenAsync() method. Ex:
Notifications.getExpoPushTokenAsync({applicationId: "xxxxxx..."})
The applicationId can be found in app's firebase config as appId.
The method getExpoPushTokenAsync() can receive some parameters, maybe some of them are not being set correctly.

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

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.

Ionic not sending push notification

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?

Categories

Resources