DEV Community

bdbch
bdbch

Posted on

How to get react-native-push-notifications to work with React Native >= 0.60

Hey! So I spent almost the whole day fiddling around with react-native-push-notifications which has a really slow update cycle.

Besides linking the package via react-native and setting up the native code in iOS it works fine out of the box on iOS devices.

On Android on the other hand, the currently available npm version of the package will break with any react native project using androidx. Thats because androidx dropped the old module structure from android.support to androidx..

Funny thing is: the fix is already commited to the master. So you can just simply install the repository from Github via

npm install npm install git+https://git@github.com/zo0r/react-native-push-notification --save
Enter fullscreen mode Exit fullscreen mode

Now you should have the fixed version in your repository! Follow the android setup guide as described in the README.

The only thing you now need to do is to add a Firebase and Google Play Services version to your apps build.gradle

Add the following values to your ext values just below the supportLibVersion:

googlePlayServicesVersion = "16.1.0"
firebaseVersion = "17.3.4"
Enter fullscreen mode Exit fullscreen mode

my ext configuration now looks like this:

ext {
    buildToolsVersion = "28.0.3"
    minSdkVersion = 16
    compileSdkVersion = 28
    targetSdkVersion = 28
    supportLibVersion = "28.0.0"
    googlePlayServicesVersion = "16.1.0"
    firebaseVersion = "17.3.4"
}
Enter fullscreen mode Exit fullscreen mode

Now you should be able to build your android project and run your app in the simulator!

Top comments (0)