Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Async Notifications in react-native

ok so I have an app in react native which retrieves the information from an api. Now the api whenever it has data to send will send the data to the device and I want my app to be always running in background so as to receive the response from the api. API can send data anytime so I want to show the user data received as soon as a message arrives.

like image 853
Ronak Khandelwal Avatar asked Jun 21 '26 18:06

Ronak Khandelwal


1 Answers

You need to look into Push Notifications. You can't guarantee that your app will always be running in the background, but Push Notifications allow you to send data to a user's phone even when the app isn't running. Once the user opens the notification you can perform some action, based on the data sent with the notification.

A good React Native component for push notifications is React Native Push Notification, which offers cross-platform notifications. Once you have this implemented you can create a handler which calls your API when the app is opened from a notification.

like image 138
Tom Walters Avatar answered Jun 25 '26 19:06

Tom Walters



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!