Implement Onesignal in the Next js app for mobile push notification

238 views Asked by At

I have a next js web app. I have successfully implemented the app OneSignal integration for the push notification in the web. And it is working fine in the web app. This web app is being used as Web View in the React Native app which is live on the Apple App Store and Google Play Store. I want to implement the push notification for Android and Mobile too. Can anyone please help me to sovle this issue. The current flow for the web app is as follows:-

  1. I initialize the app on dashboard of my app and I set the external_id with OneSignal.login(external_id);. Once user allows for the notification this external id attached with the current subscription.
  2. When user logs out, I use OneSignal.logout() method to detach this external_id with the current subscription.
  3. I'm sending the push notification with the onesignal create message API using this external_id.

I hope, I have clearly mentioned the flow. I want to implement the same in the react native but, react native app just has the web view using the url of my deployed web app

I tried to implement in the React native but it is not working as expected. I expect onesignal to initialize once user reaches to specific page(dashboard), ask for permission, once provided it should add the external_id to current subscription.

0

There are 0 answers