Pushwoosh / pushwoosh-react-native-plugin

Other
57 stars 43 forks source link

Issues on Android Integration #92

Closed mahesh-syscon closed 4 years ago

mahesh-syscon commented 4 years ago

I have followed all the instructions for setup in Android and i am getting below issues.

Note:- I have implemented all my custom navigation logic in "pushOpened" listener and i have called the init, register and added listeners in componentDidMount method. Please guide if this is wrong.

  1. Configured tag after app opened and removed app from memory. Push notification sent with segmentation which is not received when app is not running on Android.
  2. Same push notification received when app is not running on iOS but tapping on it does nothing.
  3. On Android when app is running and i tap on a notification, the app restarts and the "pushOpened" called multiple times. This does not happen in iOS. In iOS it just display the default alert inside app when app is running because i configured the boolean flag in plist to display default alert. And tapping on it, "pushOpened" called only once and the custom logic is working as expected.
  4. I have used the meta-data to display default alert in app for Android but its not working. In iOS its working after i used the key with boolean value in plist.

Please help with those issues. I already used Pushwoosh SDK for one of my iOS application in past and everything was working great. I think i am not doing right configuration and not adding right code at right place. My requirement is to receive push notification in the application with a id inside custom data and navigate to a screen inside application. Please tell me the path to a guide where i can get the idea where to use which configuration to make my flow working. My application structure is like below.

Switch Navigator -

  1. Loading - in the componentDidMount checked for user login and switched to App or Auth.
  2. Auth stack - Login screen where after login registered for push and redirected to App stack.
  3. App stack - here the set tag is called so that notification sent using segmentation comes to this device. This app stack is a drawer navigation and the set tag is on the first screen of the drawer.

The android manifest looks something like below in my app. Please guide if i am placing meta-data at wrong place. I dont have much experience in Android and i cant find the guide which can tell me where to place this.

I am not sure how much of issues i mentioned are actual issue but i think i can get help here. I have purchased the license and using this on a live project now. Its an phonegap application and now going for react native one.

Thanks.

wfhm commented 4 years ago

Hello @mahesh-syscon,

Note:- I have implemented all my custom navigation logic in "pushOpened" listener and i have called the init, register and added listeners in componentDidMount method. Please guide if this is wrong.

We do not recommend calling init method and declaring pushOpened listener in componentDidMount section, please consider calling it in the very beginning of your index.js, this way the listeners and the plugin are initialized correctly every time you interact with your push notification.

Configured tag after app opened and removed app from memory. Push notification sent with segmentation which is not received when app is not running on Android.

Tags values, once sent, are stored on Pushwoosh backend, and segmentation rules applied to push notifications are not dependent on the state of your app, be it foreground, background or closed (not force-stopped though). Please note that several device models (mostly, Huawei, Oppo, Meizu, and of some other manufacturers) kill your app when you swipe it from the Task manager. Could you please specify the device models you were testing your app with? Also, could you please submit a support ticket regarding this issue via this form?

Same push notification received when app is not running on iOS but tapping on it does nothing.

By nothing do you mean that the app is not executing your custom logics implemented in pushOpened listener, or does it not even open your app?

I have used the meta-data to display default alert in app for Android but its not working. In iOS its working after i used the key with boolean value in plist.

Please try adding it to your <application> tag with the false value:

<meta-data android:name="PW_BROADCAST_PUSH" android:value="true"/>

I have also noticed that you have raised a support ticket #46830 regarding the meta-data issue and regarding the pushOpened listener not working. Can we continue discussing these two issues in that thread?

mahesh-agrawal-616 commented 4 years ago

I am doing all you mentioned and will get back to you on the result and if any other issue. Lets continue this discussion on that thread. Please close this issue here.

mahesh-agrawal-616 commented 4 years ago

Please check below responses.

Tags values, once sent, are stored on Pushwoosh backend, and segmentation rules applied to push notifications are not dependent on the state of your app, be it foreground, background or closed (not force-stopped though). Please note that several device models (mostly, Huawei, Oppo, Meizu, and of some other manufacturers) kill your app when you swipe it from the Task manager. Could you please specify the device models you were testing your app with? Also, could you please submit a support ticket regarding this issue via this form?

The device i am using is MI poco F1. I will submit the ticket.

By nothing do you mean that the app is not executing your custom logics implemented in pushOpened listener, or does it not even open your app?

Actually it opens the app but the custom logic inside pushOpened does not get executed. I assume its not called. Need help with this.

Please try adding it to your tag with the false value:

You mean first line inside application tag right? actually i want to display the default popup when app is open and notification is received. And when user click on that custom popup, i want the pushOpened to be called and execute my custom logic.

Thank you.

wfhm commented 4 years ago

@mahesh-agrawal,

Actually it opens the app but the custom logic inside pushOpened does not get executed. I assume its not called. Need help with this.

Could you please share the code inside the pushOpened listener? We have just released the new version of the plugin which addresses the issue with pushOpened event not firing when a push with a link was opened, so, if this is your case, please update to the latest version of the plugin.

You mean first line inside application tag right? actually i want to display the default popup when app is open and notification is received. And when user click on that custom popup, i want the pushOpened to be called and execute my custom logic.

It does not really matter if it is the first or the last line, just make sure it is placed inside the tag:

<meta-data android:name="PW_BROADCAST_PUSH" android:value="true"/>