Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Is there any documentation to setup it correctly for version greater then 60. #396

Closed
sarifmiaa opened this issue Oct 15, 2019 · 18 comments
Closed

Comments

@sarifmiaa
Copy link

No description provided.

@pipoblak
Copy link

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

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

@jsina
Copy link

jsina commented Oct 22, 2019

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

@vanlinh
Copy link

vanlinh commented Oct 26, 2019

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!

@NicholasMendes
Copy link

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

@msantang78
Copy link

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

@arnaudambro
Copy link

arnaudambro commented Nov 28, 2019

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;

@Bilal-Abdeen
Copy link
Contributor

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 Android build failing due to minSdkVersion error #372
- minSdkVersion = 16
+ minSdkVersion = 19

@reactdevrocks
Copy link

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

@Bilal-Abdeen
Copy link
Contributor

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

@reactdevrocks
Copy link

reactdevrocks commented Dec 14, 2019

thank you for the above solution @Bilal-Abdeen

@matheusbaumgart
Copy link

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

@stale
Copy link

stale bot commented Feb 8, 2020

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

@stale stale bot added the 🏚 stale label Feb 8, 2020
@stale
Copy link

stale bot commented Feb 15, 2020

The issue has been closed for inactivity.

@stale stale bot closed this as completed Feb 15, 2020
@arnaudambro
Copy link

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

@stefandima
Copy link

stefandima commented Feb 16, 2020

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.

@Bilal-Abdeen
Copy link
Contributor

Bilal-Abdeen commented Feb 16, 2020

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

@stefandima
Copy link

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.

@ShaneMatthias
Copy link

ShaneMatthias commented Feb 26, 2020

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!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests