React-native-onesignal: OneSignal Platform does not recognize android devices

Created on 9 May 2018  路  12Comments  路  Source: OneSignal/react-native-onesignal

Description:

I was recently using the react-native-onesignal library and it was working perfectly with the react-native 0.53.3, but when I upgraded to version 0.55.3 the one-signal platform no longer recognized my devices, so I realized the downgrade to version 0.53.3 again, I made all the settings on the platform and the firebase, but my devices still do not recognize (I'm testing on android only), I even created a new app, I performed the installation copied my src folder, I did the settings in the / android directory and did not work.

Is there any way I can debug the one-signal packet or force a test to see what's going on? Because theoretically I followed all the steps that worked the first time.

Environment

  1. What version of the OneSignal React-Native SDK are you using?
    "react-native-onesignal": "^3.1.4"
  1. How did you add the SDK to your project (eg. npm)
    npm install --save react-native-onesignal

Most helpful comment

@gabceb Brad help me to find the solution.

Can you try going into your app/build.gradle and change from SDK version 23.0.1 to version 26.0.0?

Replace the following:

compileSdkVersion 23
buildToolsVersion "23.0.1"

...

compile "com.android.support:appcompat-v7:23.0.1"

to this

compileSdkVersion 26
buildToolsVersion "26.0.0"

...

compile "com.android.support:appcompat-v7:26.0.0"

In my case, my emulator was not finding appcompat-v7: 26.0.0, so I added it in the app/build.gradle after defaultConfigs this

    allprojects {
        repositories {
            mavenLocal()
            jcenter()
            maven {
                url 'https://maven.google.com'
            }
            maven {
                url "https://jitpack.io"
            }
            maven {
                // All of React Native (JS, Obj-C sources, Android binaries) is installed from npm
                url "$rootDir/../node_modules/react-native/android"
            }
        }
    }

Thank you @Nightsd01, for your attention and effective help.

All 12 comments

Hi @aniltonveiga ,

I am not sure what you mean when you say "onesignal does not recognize android devices"?

Are you saying the devices aren't getting registered with onesignal, don't show up in the dashboard, don't get subscribed, etc.?

You don鈥檛 have to send your full project, you could also just create a new empty app and reproduce the issue there, either way works.

Hello @Nightsd01 ,
exactly, after this upgrade and downgrade process, I've even created a new project, my devices no longer appear in the One Signal web dashboard, I do not know what I might be doing wrong, since I'm configuring it as well as it worked the first time ( following the documentation) but this time, when I make the configuration, and run de app in the device or emulator the information does not appear in the web panel. is there any way I can debug to see if everything is ok, instead of waiting for device information to appear on the dashboard?

Hi @aniltonveiga

I assume in your original post, you meant you upgraded to react-native 0.55.4?

I have tested with 0.55.4 and 0.55.3 and I cannot reproduce your issue, it works just fine.

This means that, somehow, your device isn't getting registered with OneSignal's backend. Can you zip up an example project showing this issue and send it to me so I can diagnose your problem?

yes, can I send you the zip through some more private channel?

@aniltonveiga of course! You can go to the OneSignal dashboard and click the ? button, I鈥檒l see your ticket when you post. Thanks, it will help to troubleshoot the issue.

Sent with GitHawk

Thanks @Nightsd01, I already sent it through the OneSignal dashboard :)

@aniltonveiga unsure if this is the same issue but we are seeing our no value on the one signal app id on the generated manifest.xml file.

<meta-data android:name="onesignal_app_id" android:value="" />

We do use multiple build types so our gradle files looks like this

buildTypes {
        debug {
            applicationIdSuffix = ".dev"
            defaultConfig {
              manifestPlaceholders = [ onesignal_app_id: "DEV_ID_OMITTED", onesignal_google_project_number: 'REMOTE' ]
            }
        }
        release {
            minifyEnabled enableProguardInReleaseBuilds
            proguardFiles getDefaultProguardFile("proguard-android.txt"), "proguard-rules.pro"
            signingConfig signingConfigs.release
            defaultConfig {
              manifestPlaceholders = [ onesignal_app_id: "RELEASE_ID_OMITTED", onesignal_google_project_number: 'REMOTE' ]
            }
        }
        releaseBeta {
            initWith(buildTypes.release)
            applicationIdSuffix = ".beta"
            defaultConfig {
              manifestPlaceholders = [ onesignal_app_id: "STAGE_ID_OMITTED", onesignal_google_project_number: 'REMOTE' ]
            }
        }
    }

Wondering if @Nightsd01 has anything that could help? I am investigating this at the moment so will report back any findings

It looks like we now need to initialize the app with the app_id from the RN side of things instead of the native side like before. Unsure when this changed but we will make the appropriate changes and go from there

@gabceb Brad help me to find the solution.

Can you try going into your app/build.gradle and change from SDK version 23.0.1 to version 26.0.0?

Replace the following:

compileSdkVersion 23
buildToolsVersion "23.0.1"

...

compile "com.android.support:appcompat-v7:23.0.1"

to this

compileSdkVersion 26
buildToolsVersion "26.0.0"

...

compile "com.android.support:appcompat-v7:26.0.0"

In my case, my emulator was not finding appcompat-v7: 26.0.0, so I added it in the app/build.gradle after defaultConfigs this

    allprojects {
        repositories {
            mavenLocal()
            jcenter()
            maven {
                url 'https://maven.google.com'
            }
            maven {
                url "https://jitpack.io"
            }
            maven {
                // All of React Native (JS, Obj-C sources, Android binaries) is installed from npm
                url "$rootDir/../node_modules/react-native/android"
            }
        }
    }

Thank you @Nightsd01, for your attention and effective help.

For me, Onesignal only registers sometimes, so I thought maybe Onesignal.init(appid) fails and doesnt retries. So what I did was to run Onesignal.init() several times and suprisingly it works, but I think its not a nice way to solve this.
I tried to register in native side for android, same result. Anyone has a solution for this?

@phantom1299 The new update (3.2.3) should resolve that particular issue.

If you (@aniltonveiga or anyone else) encounters this issue again please feel free to respond and I'll be happy to reopen & investigate!

I'm still unable to make it work on Android. It does not register my devices wether on an emulator or a real device. The configuration for Android seems way shorter than iOS, am I missing something? Only modified app/build.graddle and the AndroidManifest.xml files.

Was this page helpful?
0 / 5 - 0 ratings