universal-tools / UTNotificationsFeedback

7 stars 0 forks source link

Not getting callback for OnNotificationClicked #79

Closed pankajit3 closed 6 years ago

pankajit3 commented 6 years ago

Hello Team,

We have purchased UTNotification plugin for Unity from assets store. We are trying to implement Push Notifications on Android through UTNotifications.

But whenever  the app is in background or in killed state , we are not getting callback for OnNotificationClicked and OnNotificationReceived. Although we are getting callbacks in case of iOS. Kindly help  resolving the same. Android version 7.0 Regards, Development Team

yuriy-universal-ivanov commented 6 years ago

Hi @pankajit3 ,

OnNotificationClicked and OnNotificationReceived are C# events, which are dispatched into the Unity main thread from our underlying native plugins. Unless Unity is running its main thread, these events can't be called, although you should get these events after you initialize UTNotifications.Manager next time user starts your app (but it's important to subscribe to these events before initializing UTNotifications.Manager). If it's not happening for you, please prepare and send to universal.tools.contact@gmail.com a sample Unity project reproducing that issue, I'll figure out what's wrong.

Best regards, Yuriy, Universal Tools team.

pankajit3 commented 6 years ago

Hi Yurily, Thanks for response . As soon as possible I will send you my demo project on universal.tools.contact@gmail.com which we are facing problem. Regards, Development Team

pankajit3 commented 6 years ago

Hi @yuriy-universal-ivanov , Is there any update. Please solve the problem as soon as possible its very urgent. Regards, Development Team

yuriy-universal-ivanov commented 6 years ago

Hi @pankajit3,

I checked your example: all works well in Android 7. Please note a couple of moments though.

  1. The only button in your sample does nothing. I assigned scheduling a local notification to it (clicked/received notifications handling code is common in Android for local and push notifications).
  2. You're using an outdated version of UTNotifications: 1.6.3. It won't work with Android 8. Please update in the asset store.
  3. As I mentioned, notifications can't be handled while Unity main thread is not running. So handling happens only when you open application again after receiving a notification (by starting application normally or by tapping on a notification).

Best regards, Yuriy, Universal Tools team.

pankajit3 commented 6 years ago

Hi @yuriy-universal-ivanov Thanks for quick response, Could you please send me a demo project which working fine 'coz we still facing problem. Thanks Development team

pankajit3 commented 6 years ago

Hi @yuriy-universal-ivanov , Thanks for demo. But in the example you talk about local notification not for push notification.We are facing problem in push notification click .We are not getting callback for OnNotificationClicked and OnNotificationReceived. Please have a look. Thanks , Development team

yuriy-universal-ivanov commented 6 years ago

Hi @pankajit3 ,

Sure, I realize you had issue with push notifications. But the code for handling clicked/received push notifications and local notifications is shared in our native plugins, and push notification are also handled completely fine - but they are more difficult to show in a sample as they require configuration with your own server keys and having a server to send push notifications, this is why I used local notifications to show that the handling of these events works fine. Besides, other customers don't report any issues either.

Are you sure you're not sending "notifications" FCM messages? As these messages are handled by Android itself, and the app misses them. As described in our manual, you have to send "data"-only FCM messages, f.e. you can't use FCM console to send push notifications to UTNotifications. For more details see https://firebase.google.com/docs/cloud-messaging/concept-options#notifications_and_data_messages

Best regards, Yuriy, Universal Tools team.

pankajit3 commented 6 years ago

Hi @yuriy-universal-ivanov , Thanks for quick response ,Now its working fine we missed "data" part in notification thanks for help . Thanks , Development team