React-native-onesignal: Expo with Bare-minimum workflow not working

Created on 30 Sep 2020  路  12Comments  路  Source: OneSignal/react-native-onesignal

Description:
I tried to use OneSignal SDK with react native expo (bare-minuimum workflow) using this Link but when i cannot find any subscribers through OneSingal dashboard setup
Also, when i try to init a normal react-native-cli without expo, the installation and listening to subscribers works perfectly fine.
P.S. I tried to install for android devices

Environment

  • What version of the OneSignal React-Native SDK are you using? v3.9.1
  • How did you add the SDK to your project (eg. npm)
    according to the documentation i did
    • yarn add react-native-onesignal
    • expo install react-native-onesignal

    P.S.

    • I even tried without yarn add react-native-onesignal and just straight to expo install react-native-onesignal
    • Expo CLI: v3.27.12
    • NodeJs: v14.7.0
    • React-Native installed through expo init: v0.63.3

    Steps to Reproduce Issue:

  • Create firebase project with an android app with the correct bundle ID

  • Create OneSignal app with Firebase Server key and Firebase sender ID
  • Install OneSignal SDK
  • Completely follow the installation instruction from here but without iOS
  • Fire up the app with a real android device using expo start and run on android
  • Check OneSignal dashboard for new subscribers
  • Anything else:
    Again, I tried all steps on expo with bare workflow since OneSignal is a native module.

    Help Wanted

    All 12 comments

    an update, I tried run yarn android so that it uses react-native run-android and OneSignal was able to get the new subscriber. However, when using expo start then choose real android device, OneSignal is not going to work.

    You can close if you confirm OneSignal is not supposed to run on expo emulators even though the project is expo with bare workflow

    Same problem here.

    Steps to Reproduce:

    Create firebase project.
    Create OneSignal app with Firebase Server key and Firebase sender ID
    Install OneSignal SDK (yarn add react-native-onesignal)
    On App the same code from https://onesignal.com/#react
    Fire up the app with a real android device using yarn android and run on android
    Check OneSignal dashboard for new subscribers

    result:
    We haven't detected any subscribed users yet for this platform. Try some of the tips below, or contact us for support. [...]

    @bruiglesias dont' use expo's functionalities like expo start then 'a for android or 'i' for ios
    use yarn android or yarn ios
    simply run the app on react-native-cli's side
    but if your project is on expo.. you will need to eject to be expo with bare-workflow from here

    i'm using: yarn android

    you're getting any errors?

    without errors on app, but when I ckeck OneSignal dashboard for new subscribers I have: We haven't detected any subscribed users yet for this platform. Try some of the tips below, or contact us for support. [...]

    I updated my steps to reproduce above.

    @bruiglesias try init a normal RN project without expo and do the installation process and see if it works fine. with normal RN the installation is fine... and if it does work, you might have missed a step on your expo project

    @bruiglesias if nothing works
    try to follow firebase's instruction when you setup the app through firebase console

    Project-level build.gradle (/build.gradle):
    buildscript { repositories { // Check that you have the following line (if not, add it): google() // Google's Maven repository } dependencies { ... // Add this line classpath 'com.google.gms:google-services:4.3.4' } }

    App-level build.gradle (//build.gradle):
    apply plugin: 'com.android.application' // Add this line apply plugin: 'com.google.gms.google-services'
    and copy your move your google-services.json to ROOT/android/app if android and same goes for ios's instruction

    @bruiglesias ,
    Can you please update this issue? I'm curious whether the suggestion by @AbdulmalickDimnang worked for you.

    In terms of Expo, please take a look at our documentation and make sure you followed every step carefully.

    Cheers

    @AbdulmalickDimnang @rgomezp the suggestion by @AbdulmalickDimnang worked for me.

    glad it worked
    Closed

    Was this page helpful?
    0 / 5 - 0 ratings