Push Notification Plugin v2

Hi,

I am a bit new to push notifications so please bare with me if I am asking a stupid question. I was wondering how do I set up that whenever I receive a push notification the device will vibrate/make a sound. I see in the documentation that there is an event.sound which returns a string value from the notification but I was wondering how do I just set it up so that the device will make a sound or vibrate?

What have you tried so far?

If you go through the Firebase Notifications Console you just need to set Sound:Enabled under the Advanced options.

It was not working originally but I figured out the issue.

I’ve followed the documentation…  Setup the Firebase for my app…My app gets notifications while working in the foreground but not in the background. How can I enable the background notifications? 

Your app gets notifications while open? My app is actually the opposite. Can I see your code for handling notifications? 

If your app is opened and in the foreground, your app should receive a “notification” event. You can look at it to see if it’s a registration or notification subtype. At that point you can get the data from the event table. There won’t be a message from the OS saying you got a push. You could display your own dialog box showing you got the push.

If your app is backgrounded you will get a notification on the device. Interacting with that notification will foreground your app and you will get a notification event like above.

If your app is not in memory, you will get a notification on the device. Interacting with that notification will cold-start your app. The notification will come in via launchArgs.

If you get a notification and your app is either backgrounded or not running and you launch your app without interacting with the push notification, the notification will be lost.

This isn’t a Corona thing. It’s how push notifications work on devices.

Rob

@Rob Thank you very much for the information. BTW, I solved my problem. The problem was about my profiles and missing APN certificate. I had to update them and rebuild the app.

I followed this; https://firebase.google.com/docs/cloud-messaging/ios/certs

It is really strange that even if you do not have any APN certificate, the app can get messages from Firebase in the foreground. 

**@rdvitali98 **Follow the guide here; https://docs.coronalabs.com/guide/events/appNotification/index.html

You should use a notificationListener. The message is event.alert. You can use a pop up for displaying that string.

What have you tried so far?

If you go through the Firebase Notifications Console you just need to set Sound:Enabled under the Advanced options.

It was not working originally but I figured out the issue.

I’ve followed the documentation…  Setup the Firebase for my app…My app gets notifications while working in the foreground but not in the background. How can I enable the background notifications? 

Your app gets notifications while open? My app is actually the opposite. Can I see your code for handling notifications? 

If your app is opened and in the foreground, your app should receive a “notification” event. You can look at it to see if it’s a registration or notification subtype. At that point you can get the data from the event table. There won’t be a message from the OS saying you got a push. You could display your own dialog box showing you got the push.

If your app is backgrounded you will get a notification on the device. Interacting with that notification will foreground your app and you will get a notification event like above.

If your app is not in memory, you will get a notification on the device. Interacting with that notification will cold-start your app. The notification will come in via launchArgs.

If you get a notification and your app is either backgrounded or not running and you launch your app without interacting with the push notification, the notification will be lost.

This isn’t a Corona thing. It’s how push notifications work on devices.

Rob

@Rob Thank you very much for the information. BTW, I solved my problem. The problem was about my profiles and missing APN certificate. I had to update them and rebuild the app.

I followed this; https://firebase.google.com/docs/cloud-messaging/ios/certs

It is really strange that even if you do not have any APN certificate, the app can get messages from Firebase in the foreground. 

**@rdvitali98 **Follow the guide here; https://docs.coronalabs.com/guide/events/appNotification/index.html

You should use a notificationListener. The message is event.alert. You can use a pop up for displaying that string.