With active debugging I see in my console that everything is fine, the notification is sent and received by the Android device, you can hear the vibration but not the sound, I have done many tests but there is no way to make it sound.
the configuration files of github, the ones that I poked above, are fine, right ?
I would just like to get the default sound, I don’t have to customize it.
Can you give me some advice ?
Hi @davideonmeteor I use the startup/server configuration as described in the repo/ example. I do use custom sounds. Those files in the example are exactly what I use in my projects. I suggest you check on the cordova-push-plugin side if there are people experiencing the same problem. You could also open a ticket for this matter and mention your exact versions not working and maybe somebody had the same experience. Initially you mentioned that some phones don’t get the messages or so. Is that still an issue for you? :
sound: 'note', // String (file has to exist in app/src/res/... or default on the mobile will be used). For Android no extension, for IOS add '.caf'
thanx @paulishca,
I have do it but no lucky…
I have also tried to set a console.log and error in “/lib/push_methods.js”, in:
run (notification) {
// Add your Method Level security preference here.
// if (!this.userId) {
// throw new Meteor.Error(404, 'No userId was set, userId was ' + userId)
// }
console.log(“HERE”);
throw new Meteor.Error(404, ‘error test’)
// topic in IOS and Android have different behaviors. In IOS it must be set as the app id,
// in Android a notification can be sent to a topic (to its subscribers)
// Doing some cleanup on useless keys of the notification object, if any.
Object.keys(notification).map(key => (notification[key] === null || notification[key] === undefined) && delete notification[key])
The strange is that console.log is not display in my console, and no error… should appear, right ?!
If you can give me another indication:
For the sound, I extract myApp.apk, there isn’t a path like “app/src/res”, what is the right path where the audio file must be ? I use a audio file named ‘alya.ogg’.
I have done a little step forward…
I discovered that in notification option in the app, there is a PhoneGap PushPlugin and the audio was set to “audio supplied by the app”, if I change this setting and I choose a sound tone, the notification now will sound !
Now, I want to set a custom sound, because I don’t want users to have to set this manually.
In meteor you can set resource in mobile-config.js by "App.addResourceFile(‘sound1.mp3’, ‘res/raw/sound1.mp3’, ‘android’) but it doesn’t work.
adb logcat shows me this message “FileSource: Failed to open file ‘android.resource://app.myapp/raw/true’. (No such file or directory)”.
Isn’t it weird ? Why the path is “app.myapp/raw/true”, I was expecting “app.myapp/raw/sound1.mp3”.
How did you set “App.addResourceFile(‘sound1.mp3’, ‘res/raw/sound1.mp3’, ‘android’)” exactly ? (obviously using “note” instead of “sound1”).
I think I understand the problem, it is a bug of the Cordova component https://github.com/phonegap/phonegap-plugin-push which misprints the path of the sound file (that’s why in the logcat appears "FileSource: Failed to open file ‘android.resource: //app.myapp/raw/true’. (No such file or directory) ".
I then simply removed the “sound” key in “https://github.com/activitree/meteor-push/blob/master/example/app/startup/client/index.js” and now the notification plays the default sound , if you want to customize the sound you have to do it from the settings of the Cordova plugin in the device itself.
Another consideration is that this behavior I have on Android 9, on Android 7 instead it works well and on Android 8 I was unable to try it. @paulishca, I don’t know why it worked the same for you, maybe your app is only used on Android 7, or you have an old version of the Cordova plugin.
Hi @davideonmeteor I am not an expert in Android. This package leverages on existing Cordova plugins which are not in my control. Simply put, any Cordova plugin has hooks in both directions. In my case Meteor <–>Cordova Plugin <–>Android. I only control Meteor + the hooks into the Cordova plugin. The plugin itself and what is left of the entire ‘ecosystem’ are not in the scope of this package. However, if you find a feature in Firebase Admin (FMC) or Cordova plugin that is not implemented, you can open a PR in the package itself and have it implemented or open a ticket and wait for somebody to do it.
I hope this helps.
Hi, for general info: With the same push plugin, I also had to change the sound: setting in the client-init from true to default to get the default sound to play.
yes, but in your presentation you using onesignal for push notifications service, not firebase, so activitree-push plugin doesnt works. @filipenevola do you think is a good choice not using Firebase service (Google services) ? What about using resource for a new service, for battery, network…
I mean with onesignal.com don’t works, with firebase (Google service) ther is’nt problem, works good.
Or I’m wrong ? @paulishca activitree-push can use with onesignal.com ?
activitree:push is a self sufficient solution, just like RAIX:push (which unfortunately is now deprecated) doesn’t have external dependencies other than the configuration required in Google Firebase. For apps with tens of thousands of users and above, a dedicated activitre:push server connected in a secondary MongoDB of a cluster might be even better so you can use Client/Server components for user registration and a separate server for sending messages. The problem with Cordova is that those Cordova plugins which are open source do not keep up with the mobile OS releases as fast as we’d like.
We’re currently developing a new version of our meteor app using React Native for the front end. I was wondering if activitree/meteor-push is still the best way to send push notifications.