Open Mia12344 opened 5 years ago
I had this problem, I believe it is related to the notification channel that api 26 should be configured for users to receive the notifications, follow the steps to have the problem solved.
put this in your strings.xml
<string name="default_notification_channel_id" translatable="false">default</string>
put this in your AndroidManifest.xml
<application ...>
<meta-data android:name="com.google.firebase.messaging.default_notification_channel_id" android:value="@string/default_notification_channel_id"/>
...
</ application>
hey @marcelomiranda90 i do not have string.xml also project is not working by adding
hear is my error log
What went wrong: Execution failed for task ':app:processDebugResources'.
Android resource linking failed Output: /Users/m.tahir/projects/projects/seefarma/platforms/android/app/build/intermediates/merged_manifests/debug/processDebugManifest/merged/AndroidManifest.xml:73: error: resource string/default_notification_channel_id (aka org.seefarma:string/default_notification_channel_id) not found. error: failed processing manifest.
Command: /Users/m.tahir/.gradle/caches/transforms-1/files-1.1/aapt2-3.2.0-4818971-osx.jar/aa71992d4efad0b910b2a09c19790d9d/aapt2-3.2.0-4818971-osx/aapt2 link -I\ /Users/m.tahir/Library/Android/sdk/platforms/android-28/android.jar\ --manifest\ /Users/m.tahir/projects/projects/seefarma/platforms/android/app/build/intermediates/merged_manifests/debug/processDebugManifest/merged/AndroidManifest.xml\ -o\
the file must be in:
app/App_Resources/Android/src/main/res/values/strings.xml
after including the channel id, your strings.xml should look like this:
<?xml version="1.0" encoding="utf-8"?>
<resources>
<string translatable="false" name="app_name">name of app</string>
<string translatable="false" name="title_activity_kimera">name of app</string>
<string name="default_notification_channel_id" translatable="false">default</string>
</resources>
after saving the change, run:
tns platform remove android tns run android
Trying to use with NativeScript-Vue and getting no device token back with ios
import { messaging, Message } from "nativescript-plugin-firebase/messaging";
Vue.prototype.$router = router
Vue.prototype.$goto = function (to, options) { this.$navigateTo(this.$router[to], options) }
console.log(messaging);
messaging.registerForPushNotifications({ onPushTokenReceivedCallback: (token) => { console.log("Firebase plugin received a push token: " + token); },
onMessageReceivedCallback: (message) => { console.log("Push message received: " + JSON.stringify(message, getCircularReplacer())); }, showNotifications: true, showNotificationsWhenInForeground: true }).then(() => console.log("Registered for push"));
messaging.getCurrentPushToken() .then(token => console.log(Current push token: ${token}));
[org.nativescript.events-mobi] Requested authorization [ didGrant: 1 hasError: 0 hasCompletionHandler: 1 ] [org.nativescript.events-mobi] Requesting token for remote notifications [org.nativescript.events-mobi] Requested token for remote notifications [ didSucceed: 1 hasError: 0 hasCompletionHandler: 1 ] [org.nativescript.events-mobi] Did receive remote notification token [org.nativescript.events-mobi] Sending received device token to delegate UIApplication HTHangEventCreate: HangTracing is disabled. Not creating a new event. removing all entries config 0x280898840 Task .<1> resuming, QOS(0x19) TIC TCP Conn Start [4:0x283dd3240]
its not working for me @marcelomiranda90 hear is the repo can you see this https://github.com/Mia12344/testing
if i add the device token and server id then i have received the notification curl -X POST --header "Authorization: key=SERVER_KEY" --Header "Content-Type: application/json" https://fcm.googleapis.com/fcm/send -d "{\"notification\":{\"title\": \"My title\", \"text\": \"My text\", \"badge\": \"1\", \"sound\": \"default\"}, \"data\":{\"foo\":\"bar\"}, \"priority\": \"High\", \"to\": \"DEVICE_TOKEN\"}"
@marcelomiranda90 hey i have working on it and able to get notification from firebase but its working is not fine . For 10 build i have produced only for one time i am able to get the notification but most of case i am not able to get message from firebase ? What type of issue is that?
From what I realized the problem we are seeing has to do with the limit of execution in the background:
https://developer.android.com/about/versions/oreo/background?hl=en
I captured this log when sending a message from the firebase console:
12-06 08:53:42.185 1536 10179 W ActivityManager: Background start not allowed: service Intent { act=com.google.firebase.MESSAGING_EVENT
Now I'm looking for a solution, it happens when we compile with api 28, which is now mandatory for new apk's.
@EddyVerbruggen Do you have a tip for us? Thank you.
Someone already fix this issue?
i am using nativescript firebase and when i push message from firebase console then message is not received on android app . but when i use
curl -X POST --header "Authorization: key=SERVER_KEY" --Header "Content-Type: application/json" https://fcm.googleapis.com/fcm/send -d "{\"notification\":{\"title\": \"My title\", \"text\": \"My text\", \"badge\": \"1\", \"sound\": \"default\"}, \"data\":{\"foo\":\"bar\"}, \"priority\": \"High\", \"to\": \"DEVICE_TOKEN\"}"
then i will receive the message on my appi have provided the same server_key and device_token on google-services.json but its only working on local side not with the firebase web app
may be this issue is related to https://github.com/EddyVerbruggen/nativescript-plugin-firebase/issues/1039