mobile-messaging-react-native-plugin icon indicating copy to clipboard operation
mobile-messaging-react-native-plugin copied to clipboard

messageReceived Library Event on iOS Devices Not Triggering

Open moustafadevrn opened this issue 10 months ago • 3 comments

Description: The messageReceived library event works successfully on Android devices but does not trigger on iOS devices. This inconsistency needs to be addressed to ensure the functionality is consistent across both platforms.

Steps to Reproduce: Implement the messageReceived event in the app. Trigger an event that should activate messageReceived. Observe the behavior on Android and iOS devices.

Expected Behavior: The messageReceived event should trigger consistently on both Android and iOS devices.

Actual Behavior: The event triggers as expected on Android devices but does not trigger on iOS devices.

moustafadevrn avatar Apr 18 '24 13:04 moustafadevrn

Hi @moustafadevrn, in our Example app (included within the SDK), HomeScreen.js file, function HomeScreen, block code of useEffect, I added the following:

mobileMessaging.subscribe( 'messageReceived', eventData => { console.log('Event received', eventData); } );

Then I triggered a notification through chat message, broadcasted a regular push, and also a In-App push through Moments, and all three printed the 'Event received' and its content on my real iOS device, even with the app in background. I don't know what the issue in your end is, could you please retry with our Example app perhaps?

fortesdev avatar Apr 19 '24 08:04 fortesdev

Hello @fortesdev

Thank you for your suggestion. I actually tried the same line of code you mentioned. However, the event is not triggered as you suggested.

As I mentioned before, the notification is not received while the app is in the foreground.

Furthermore, I have searched for the code block you mentioned in the HomeScreen.js file located in the Example folder of the SDK, but I couldn't find any code like that.

moustafadevrn avatar Apr 21 '24 08:04 moustafadevrn

Hi @moustafadevrn,

I wrote that "I added" that line of code (that you can write as well, not to search for it), in line 11 here.

And it works on my testing: App in foreground, broadcasting regular push => event received (notification not visible as it is silent) App in foreground, chat message received, but chat not present => event received (notification visible) App in foreground, chat message received, but chat present => event and notification not received by design, as explained here.

If you still face issues, feel free to check/share [MobileMessaging] console logs (excluding your ids/secrets), but also test with our Example if possible.

fortesdev avatar Apr 22 '24 07:04 fortesdev

I'll close the issue due to inactivity, feel free to reopen it if needed.

riskpp avatar Aug 16 '24 10:08 riskpp