flurry / react-native-flurry-sdk

React Native Flurry SDK
Apache License 2.0
45 stars 13 forks source link

Loading application from coldstart doesnt trigger message listener #6

Closed thessler27 closed 5 years ago

thessler27 commented 5 years ago

When entering the application from a push notification with the app killed, the Flurry.addMessagingListener doesn't trigger the push notification. Is there a way to get access to a push notification from coldstart?

poting-oath commented 5 years ago

Thanks for the report! Yes, this is a known issue/behavior. The "user" listener is written from the JavaScript side, while the Flurry Push is on the Android native side. When app is gone, all JavaScript is not active. Hence when Message comes, we can only trigger Android platform, but not the inactive React Native.

poting-oath commented 5 years ago

The workaround is to put your handling in the Android Application class, MainApplication.java. Then when Message comes, the native Android is active to handle it.

thessler27 commented 5 years ago

Thanks for the quick response! I've done this for android, but is there a workaround for iOS?

poting-oath commented 5 years ago

Based on your feedback, we will add an API (Android native) in FlurryModule. When you need to handle from cold start as well, you can just pass your listener in withMessaging method.

poting-oath commented 5 years ago

Let me check on the iOS side.

thessler27 commented 5 years ago

Thanks for looking into it. Really appreciate it 👍

poting-oath commented 5 years ago

@thessler27 In the next release, iOS will allow users to initialize Flurry Push natively in UIApplication as well to fix the cold start issue. Thanks a lot for your feedback!

thessler27 commented 5 years ago

@poting-oath really appreciate you guys looking into this! thanks again.

poting-oath commented 5 years ago

@thessler27 We just released a new version 3.2.0 with the feature that allows optional user's native FlurryMarketingOptions or FlurryMessagingListener. Thanks a lot for your great feedback!

FlurryModule.Builder will accept user's messaging options or listener as,

When users provide their own options or listener, the JavaScript listener will be disabled.

poting-oath commented 5 years ago

For iOS, we also support Flurry Push initialization from AppDelegate to handle notifications from a cold start. Please refer to README for detailed instruction.