-
-
Notifications
You must be signed in to change notification settings - Fork 197
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Notifications to Android 8.0+ are blocked because notification channels are required #341
Comments
According to https://developer.android.com/training/notify-user/channels To register a notification channel, this code is executed:
It's java that needs to be directly integrated into Cordova, or there needs to be a Cordova package allowing us to execute this from the JavaScript. Note that the guide says:
|
This might be of help :
|
Any updates? Did you get it resolved? |
Haven't gotten a chance to attempt implementing this fix yet, though it seems promising. Will update once I've tried it. |
Follow up question. Once the channel is implemented, how do you specify the channel when sending the notification? |
Code works to register a channel. Now need to figure out how to send a notification to a specific channel. |
@TheRealNate we have to change: Allow user to set payload: var data = (notification.payload) ? { ejson: EJSON.stringify(notification.payload) } : {}; data.title = notification.title; add something like: data.android_channel_id = notification.channel_id |
Would this be correct usage?
|
@TheRealNate I'll try testing it when I get home. |
It seems to be removing the argument android_channel_id before it gets to the code around line 309 |
@TheRealNate so we have to add a new field android_channel_id to the collection: |
Done, https://github.com/TheRealNate/push/blob/master/lib/common/notifications.js Testing these changes. Is it enough to allow the argument? |
I'm no longer getting the error message, so the channel id seems to be making it to the code in push/lib/server/push.api.js, yet notifications still don't seem to be working. |
@TheRealNate If you registered the device: in the readme: but in: It looks like we are adding formatting it slight differently. |
The logs do confirm when
And
|
As for node-gcm, you seem to be right. I cannot find any mention of notification channels anywhere in the GitHub repo (https://github.com/ToothlessGear/node-gcm/search?q=channel&unscoped_q=channel) Perhaps the official API (https://firebase.google.com/docs/reference/admin/) could work? |
Here's another weird thing. I am unable to send notifications directly from the Firebase Console. Maybe some changes to the manifest need to be made (https://firebase.google.com/docs/cloud-messaging/android/client) |
Yea I noticed that too. Even when the notifications were working they were never integrated into firebase. It always showed blank. |
So this is the correct format which is similar: My recommended format for your push payload when using this plugin (while it differs from Google's docs) works 100% of the time: { In the FCM-NODE: Warning: on February 2, 2017, the Firebase Team released the admin.messaging() service to their node.js admin module. This new service makes this module kind of deprecated |
@da314pc do you have any idea where they are obtaining surveyID? Also, how would you do this using Push.send? Would everything in data go inside payload? |
not sure |
@TheRealNate in your Push.send: did you remember to include the android_channel_id? |
Where would I put it in the arguments object? At root level, in gcm, in
data, or in payload.
…On Mon, Aug 13, 2018, 2:14 PM da314pc ***@***.***> wrote:
@TheRealNate <https://github.com/TheRealNate>
one more thing to check,
in your Push.send: did you remember to include the android_channel_id?
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#341 (comment)>, or mute
the thread
<https://github.com/notifications/unsubscribe-auth/APg4Q_qW1NMKTdf4LYB9Y1gxR1HZkIYlks5uQcH2gaJpZM4VO0Sw>
.
|
So everything looks fine, but when you send the notification from the server: Push.send({ |
I'm doing exactly that except I'm leaving the query as {}.
|
That's probably the problem, the device token is registered with the userId, so if the userId is blank, the Push notification can't find the device token in the database, Push looks up the collection by userId ("im pretty sure") Its all database driven, so for the test, make sure in the then send the userId in query from the server, so you kind of have to have a user logged in for this to work. |
I'll try that, however I've noticed that the server still outputs that it
successfully sent the notification to x devices.
|
Will this be implemented in the official release version? |
After adding all the dependencies and loading the plugin, my app still won't connect to google firebase. |
@CineXMike what issue are you getting? Also are you using the repo I have? |
No issue, |
@CineXMike your sending the channel on the server too? |
@da314pc I test this fork https://github.com/FishSaidNo/push la to switch to FCM on meteor 1.8 for build you have to use that for me
in /mobile-config.js add in addition to the rest
add google-services.json to the root of your meteor project be careful if you went from "raix:push" to this fork the client side configuration there is "cordovaOptions" which includes the config which was not present before do not forget that "payload" must be JSON.stringify with FCM you need to activate the FCM API https://console.developers.google.com/apis/api/fcm.googleapis.com/overview?project=XXXXXXXXXX if you want to configure FCM for ios https://medium.com/@felipepucinelli/how-to-add-push-notifications-in-your-cordova-application-using-firebase-69fac067e821
Doc |
@MrSpark2591 this project needs a new maintainer. Once we get that settled we can add in the changes and update the docs to make it easy for anyone to upgrade for android 8 |
@da314pc Let me know if i can be helpful. I will be more than happy to contribute :) |
Hi @da314pc , Is your version already implemented with the official release? Your version works on local servers but we cant seem to implement it in the production server since it is installing raix:push. Thanks |
Hi @da314pc Can you provide the exact step to make notification working on Android 8+? I tried with your fork of the repo. No error is coming but there are no notifications as well. Thanks |
@ashish979 I will integrate the code into the and update the repo. What errors are you seeing in your gradle file? |
Finally I got this working with https://github.com/FishSaidNo/push fork. For future reference, below is the series of steps I followed:
Try to build it with all these configurations. Notifications in android should work. |
@ashish979 with version [email protected] (version of cordova update) more need to use build-extras.gradle and one can use version [email protected] |
@aboire I tried building with 1.8.1-beta.15 but breaking the ios build also. So, for the time being I will go with the above configuration and wait for a stable release of 1.8. @da314pc Thanks for the help but with your configuration, I am not able to build the app. Therefore, as I said I am going with the above configuration. #359 #354 Both pull requests have similar changes. @raix Can you review and merge any any one of them so that this issue is closed. |
@ashish979 what is the error on ios, me I build without problem? |
@ashish979 were in the processes of getting the pull request merged in, #359 configurations.all {
|
@ashish979 let me know if I should add you on the contributor team |
Yes, you can. |
@ashish979 @lokiribeiro we have just merged in the changes into the release. |
Thanks so much to the contributors and others that researched this and updated the package and the readme to make it work! I've been struggling to get it to work in my own app, likely due to dependency issues. But I made a small dummy app in which it's working perfectly in Android both 7 and 8. I thought I'd share it here in case it helps anyone: https://github.com/namenotrequired/meteor-push-example |
Is the FishSaidNo fork the only option for FCM with Meteor 1.8? |
No description provided.
The text was updated successfully, but these errors were encountered: