React-native-notifications: Is there any documentation to setup it correctly for version greater then 60.

Created on 15 Oct 2019  路  18Comments  路  Source: wix/react-native-notifications

馃彋 stale

Most helpful comment

I was able to make it work with the version 2.1.5 and RN 0.61.2

Android
add to the react-native.config.js to ignore it on the auto-linking:

module.exports = {
  dependencies: {
    'react-native-notifications': {
      platforms: {
        android: null
      },
    },
 },
}

add to the settings.gradle:

include ':reactnativenotifications'
project(':reactnativenotifications').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-notifications/android/app')

build.gradle:

buildscript {
    ...
    dependencies {
        ...
        classpath 'com.google.gms:google-services:4.3.0' // <-- add this
    }
}

app/build.gradle:

android {
  defaultConfig {
     ...
     //add this
     missingDimensionStrategy "RNNotifications.reactNativeVersion", "reactNative60"
   }
}
dependencies {
    ...
    // add both
    implementation project(':reactnativenotifications');
    implementation 'com.google.firebase:firebase-core:16.0.7';
}
apply plugin: 'com.google.gms.google-services' // add this at the end of the file

MainApplication.java:

 private final ReactNativeHost mReactNativeHost =

      @Override
      protected List<ReactPackage> getPackages() {
        @SuppressWarnings("UnnecessaryLocalVariable")
        List<ReactPackage> packages = new PackageList(this).getPackages();

        //add the package here (note the this.getApplication())
        packages.add(new RNNotificationsPackage(this.getApplication())); 
        return packages;
      }

Ios

cd ios
pod install

And follow the steps here :https://github.com/wix/react-native-notifications/blob/2.1.5/docs/installation.md
to edit the AppDelegate.m

All 18 comments

Same problem here, i tried everything, and nothing works...

"react": "16.9.0",
"react-native": "0.61.2",

I'm also have some issue just like @pipoblak
I'm using "react-native-notifications": "^2.0.6",

I am using version 2.0.6 with react-native 0.61.2. It works fine on android, but got error during manually link on iOS. Could not build the app on xcode.
Any suggestion for this issue would be really appreciated!

Also cant get this to work on "react-native": "0.61.2"

I was able to make it work with the version 2.1.5 and RN 0.61.2

Android
add to the react-native.config.js to ignore it on the auto-linking:

module.exports = {
  dependencies: {
    'react-native-notifications': {
      platforms: {
        android: null
      },
    },
 },
}

add to the settings.gradle:

include ':reactnativenotifications'
project(':reactnativenotifications').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-notifications/android/app')

build.gradle:

buildscript {
    ...
    dependencies {
        ...
        classpath 'com.google.gms:google-services:4.3.0' // <-- add this
    }
}

app/build.gradle:

android {
  defaultConfig {
     ...
     //add this
     missingDimensionStrategy "RNNotifications.reactNativeVersion", "reactNative60"
   }
}
dependencies {
    ...
    // add both
    implementation project(':reactnativenotifications');
    implementation 'com.google.firebase:firebase-core:16.0.7';
}
apply plugin: 'com.google.gms.google-services' // add this at the end of the file

MainApplication.java:

 private final ReactNativeHost mReactNativeHost =

      @Override
      protected List<ReactPackage> getPackages() {
        @SuppressWarnings("UnnecessaryLocalVariable")
        List<ReactPackage> packages = new PackageList(this).getPackages();

        //add the package here (note the this.getApplication())
        packages.add(new RNNotificationsPackage(this.getApplication())); 
        return packages;
      }

Ios

cd ios
pod install

And follow the steps here :https://github.com/wix/react-native-notifications/blob/2.1.5/docs/installation.md
to edit the AppDelegate.m

hi @msantang78 i did what you said for Android and here is what I have

error: cannot find symbol
packages.add(new RNNotificationsPackage(this.getApplication()));

How can I import the package ?

[EDIT]

Found it in the docs
import com.wix.reactnativenotifications.RNNotificationsPackage;

I was able to make it work with the version 2.1.5 and RN 0.61.2

Android
add to the react-native.config.js to ignore it on the auto-linking:

module.exports = {
  dependencies: {
    'react-native-notifications': {
      platforms: {
        android: null
      },
    },
 },
}

add to the settings.gradle:

include ':reactnativenotifications'
project(':reactnativenotifications').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-notifications/android/app')

build.gradle:

buildscript {
    ...
    dependencies {
        ...
        classpath 'com.google.gms:google-services:4.3.0' // <-- add this
    }
}

app/build.gradle:

android {
  defaultConfig {
     ...
     //add this
     missingDimensionStrategy "RNNotifications.reactNativeVersion", "reactNative60"
   }
}
dependencies {
    ...
    // add both
    implementation project(':reactnativenotifications');
    implementation 'com.google.firebase:firebase-core:16.0.7';
}
apply plugin: 'com.google.gms.google-services' // add this at the end of the file

MainApplication.java:

 private final ReactNativeHost mReactNativeHost =

      @Override
      protected List<ReactPackage> getPackages() {
        @SuppressWarnings("UnnecessaryLocalVariable")
        List<ReactPackage> packages = new PackageList(this).getPackages();

        //add the package here (note the this.getApplication())
        packages.add(new RNNotificationsPackage(this.getApplication())); 
        return packages;
      }

Ios

cd ios
pod install

And follow the steps here :https://github.com/wix/react-native-notifications/blob/2.1.5/docs/installation.md
to edit the AppDelegate.m

Thank you for this. It is very useful. In addition, to what you said,

  1. in (MainApplication.java) I have:
    import com.wix.reactnativenotifications.RNNotificationsPackage;
  2. in (build.gradle), I applied the following change. I hope this will NOT break anything. This is my 1st RN project! This was necessary to avoid the error reported in #372
- minSdkVersion = 16
+ minSdkVersion = 19

where can i find react-native.config.js file? @Bilal-Abdeen @msantang78

@reactdevrocks You can create this file at the root of your project (in the same folder where package.json file is.)

thank you for the above solution @Bilal-Abdeen

Even after the changes above it still doesn't recognise the argument for me :(

constructor RNNotificationsPackage in class RNNotificationsPackage cannot be applied to given types; new RNNotificationsPackage(), ^ required: Application found: no arguments reason: actual and formal argument lists differ in length

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs.

The issue has been closed for inactivity.

Really hate those bots that close an unresolved issue... what the point ??

I'm unable to make铆t work. I have

    "react": "16.9.0",
    "react-native": "0.61.5",
    "react-native-notifications": "^3.1.1" (downgraded from 3.1.2)

And i receive:
MainApplication.java:17: error: package com.wix.reactnativenotifications does not exist.
and obvious:

MainApplication.java:34: error: cannot 
find symbol
          packages.add(new RNNotificationsPackage(MainApplication.this));
                           ^
  symbol: class RNNotificationsPackage

I try even manual linking. I read everithing i could found.
Some help please.

Please, double-check that you have followed the latest installation instructions, specifically the step to update the app/build.gradle file.
https://github.com/wix/react-native-notifications/blob/master/docs/installation-android.md#step-4-add-firebase-core-package-and-apply-google-services-plugin-in-projectappbuildgradle

That step is needed only if:
_Note: This section is only necessary in case you wish to be able to receive push notifications in your React-Native app._
But i want only to give notifications from application.
I dont know, and is not in my scope, to use Google FCM Service.

Hey, creating the config file in my root folder doesn't seem to be disabling auto-linking for android. Am I missing a setup process or something?

EDIT: Nevermind! It was actually a different error I was getting. It's fixed!

Was this page helpful?
0 / 5 - 0 ratings

Related issues

Bilal-Abdeen picture Bilal-Abdeen  路  4Comments

veedeo picture veedeo  路  6Comments

WhereBeTheDan picture WhereBeTheDan  路  5Comments

Lastin picture Lastin  路  5Comments

ghost picture ghost  路  3Comments