urbanairship / react-native-airship

Airship React Native module
Other
88 stars 62 forks source link

Push notifications not enable on some devices #99

Closed Diego-Franco closed 6 years ago

Diego-Franco commented 6 years ago

I'm building and app with the react native module, I'm trying to enable push notifications for my app.

Devices: Samsung galaxy S6 (7.0) , Samsung Galaxy On 5 (6.0.1)

Steps:

Expectation:

More:

rlepinski commented 6 years ago

Are you enabling user notifications ? What OS versions? Did you disable notifications at the app level? Settings -> App Info -> App -> Notifications ?

Diego-Franco commented 6 years ago

Yes, and yes, I did all the steps for notifications, the OS versions is pointed in the issue, for the Galaxy S6 is Android 7.0 and for the galaxy On 5 is Android 6.0.1

and like I said, my previous native android app is working fine on the Galaxy S6

rlepinski commented 6 years ago

This is running the same SDK that runs on a native app.

Here is the call that determines that opt in status: https://github.com/urbanairship/android-library/blob/fbfbcde094cca307cfd2906a508d4262546d2e37/urbanairship-sdk/src/main/java/com/urbanairship/push/PushManager.java#L544

Things that could cause it to be opted out:

Assuming its the same code running on both phones, you can probably rule out push and user notifications being disabled on the SDK. My guess its most likely Google Play Services being out of date. Your react version is probably pulling in a newer version of the Play Services than your native app.

You should see something in the logs during start up. You can also add

import com.urbanairship.google.PlayServicesUtils;
...

public class MainActivity extends ReactActivity {
    ...

    @Override
    public void onResume() {
        super.onResume();

        // Handle any Google Play services errors
        if (PlayServicesUtils.isGooglePlayStoreAvailable(this)) {
            PlayServicesUtils.handleAnyPlayServicesError(this);
        }
}

To the MainActivity.java to have it prompt the user to install latest version.

Diego-Franco commented 6 years ago

Thanks for your help, I forgot about Play services, and I just updated the Google play services and works, I'm going to put this check in the native code.