3

I have made a mobile app using react-native (only android for now and it is not an expo app) and I would like to add push notifications to this app. The app is some kind of a social media and when the user is on scrolling the "news feed" the mobile app makes each 3 seconds a request on the server to see if there is a new notification.

On the server is a Ruby on Rails web-app that has a small dashboard so the admin can block misbehaving users and there are some API controllers that return JSON-s for the mobile app. So the mobile app will make a request to the notifications controller and if there are any new notifications user will see them on the react-native mobile app. When the mobile app is closed and there is a new notification on the server the user won't see it until the mobile app is active and can make requests to the notifications controller.

Is there some way to notify the user when the app is closed? I found this service: https://github.com/geektimecoil/react-native-onesignal

At this time I'm not using Firebase but if I have understood it correctly I will somehow need to send the new notification that is created in my Ruby on Rails web-application to the Firebase service and then will Onesignal service get it from Firebase and display it as a push notification on the users smartphone even if the mobile application is closed?

Have I understood it correctly? Is there some easier way to achive my goal or some good tutorial that will help me to implement it like described?

1 Answer 1

1

I have used onesignal for my application which works amazing with android and ios if you want I can share the git repo for the same. It will work like a charm as you are not using expo, it is difficult with expo

Sign up to request clarification or add additional context in comments.

2 Comments

Yes please! I have started as described and I know now how to push data form rails app to firebase. Also added Onesignal to react-native app but the app chrashes bc of this line: OneSignal.init('....'). I would love you see your repo. Thank you
you can download this from github.com/davekedar/push_with_onesignal and the perfect documentation is here documentation.onesignal.com/docs/react-native-sdk-setup

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.