question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Conflict zo0r/react-native-push-notification and @aws-amplify/pushnotification

See original GitHub issue

Hello

I do not know how to do it because I have a conflict of package namely: i am using @aws-amplify/pushnotification for remote push notifications and i want to use zo0r / react-native-push-notification for local notifications and badge. Here is the problem :

in the MainApllication.java file for the @ aws-amplify / pushnotification package we need to include importing this import com.amazonaws.amplify.pushnotification.RNPushNotificationPackage and add new RNPushNotificationPackage (). for the zo0r / react-native-push-notification package we need to import com.dieam.reactnativepushnotification.ReactNativePushNotificationPackage and add ReactNativePushNotificationPackage.

I have an error NATIVE model RNPushNotification tried to override RNPushNotificationModule for Mofule name RNPushNotification if this was your intention, set canOverrideExistingModule = true. (See photos ) => http://www.noelshack.com/2018-41-1-1539003383-conflict-package.jpeg

i think there is a conflict between @ aws-amplify / pushnotification and zo0r / react-native-push-notification, please how do I resolve this conflict because i need local notifications and badges for my application?

Source Code File File MainApllication.java ` package com.katika; import android.app.Application; import com.facebook.react.ReactApplication; import com.oblador.vectoricons.VectorIconsPackage; import com.android.freshchatSdk.FreshChatReactPackage; import com.amazonaws.amplify.pushnotification.RNPushNotificationPackage; import com.robinpowered.react.Intercom.IntercomPackage; import io.intercom.android.sdk.Intercom; import com.masteratul.RNAppstoreVersionCheckerPackage; import io.xogus.reactnative.versioncheck.RNVersionCheckPackage; import com.microsoft.codepush.react.CodePush; import io.invertase.firebase.RNFirebasePackage; import com.ocetnik.timer.BackgroundTimerPackage; import io.underscope.react.fbak.RNAccountKitPackage; import com.facebook.react.ReactNativeHost; import com.facebook.react.ReactPackage; import com.facebook.react.shell.MainReactPackage; import com.facebook.soloader.SoLoader; import io.underscope.react.fbak.RNAccountKitPackage; import io.invertase.firebase.analytics.RNFirebaseAnalyticsPackage; import io.invertase.firebase.notifications.RNFirebaseNotificationsPackage; import io.invertase.firebase.functions.RNFirebaseFunctionsPackage; import io.invertase.firebase.messaging.RNFirebaseMessagingPackage; import io.invertase.firebase.fabric.crashlytics.RNFirebaseCrashlyticsPackage; // <-- Add this line import io.invertase.firebase.crash.RNFirebaseCrashPackage; // <-- Add this line import io.invertase.firebase.firestore.RNFirebaseFirestorePackage; // <-- Add this lin.util.Arrays;e import com.dieam.reactnativepushnotification.ReactNativePushNotificationPackage ; // <— Import Package

import java.util.Arrays; import java.util.List;

public class MainApplication extends Application implements ReactApplication {

private final ReactNativeHost mReactNativeHost = new ReactNativeHost(this) {

    @Override
    protected String getJSBundleFile() {
    return CodePush.getJSBundleFile();
    }

@Override
public boolean getUseDeveloperSupport() {
  return BuildConfig.DEBUG;
}

@Override
protected List<ReactPackage> getPackages() {
  return Arrays.<ReactPackage>asList(
      new MainReactPackage(),
        new VectorIconsPackage(),
        new FreshChatReactPackage(),
        new RNPushNotificationPackage(),
        new IntercomPackage(),
        new RNAppstoreVersionCheckerPackage(),
        new RNVersionCheckPackage(),
        new CodePush("bySq16a9P0d2pIdf9ZZvyaRJbzcOSJ8Sg7bHX", getApplicationContext(), BuildConfig.DEBUG),
        new RNFirebasePackage(),
        new BackgroundTimerPackage(),
        new RNAccountKitPackage(),
        new RNFirebaseAnalyticsPackage(),
        new RNFirebaseNotificationsPackage(),
        new RNFirebaseFunctionsPackage(),
        new RNFirebaseMessagingPackage(),
        new RNFirebaseCrashlyticsPackage(),
        new RNFirebaseFirestorePackage(),
        new RNFirebaseCrashPackage(),
        new ReactNativePushNotificationPackage () // <-- Add this line
  );
}

@Override
protected String getJSMainModuleName() {
  return "index";
}

};

@Override public ReactNativeHost getReactNativeHost() { return mReactNativeHost; }

@Override public void onCreate() { super.onCreate(); SoLoader.init(this, /* native exopackage */ false); Intercom.initialize(this, “android_sdk-83be2abcbbe01abc199897d691de1c8b47f703d3”, “tduveiqw”); }

} `

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:14

github_iconTop GitHub Comments

8reactions
kushansoncommented, Oct 14, 2018

Hi, I am working on making these libraries compatible in my own project.

I found that I can get around the error you are seeing by doing the following:

  • In ./node_modules/react-native-push-notification/android/src/main/java/modules/RNPushNotification.java make these changes: before: @Override public String getName() { return "RNPushNotification"; } after: @Override public String getName() { return "RNPushNotificationModule"; }
  • In ./node_modules/react-native-push-notification/component/index.android.js, make the following changes before: var RNPushNotification = NativeModules.RNPushNotification; after: var RNPushNotification = NativeModules.RNPushNotificationModule;

This should fix the naming collision between the two libraries by renaming the react-native-push-notification module. I am planning on using this fix until aws-amplify supports local notifications.

4reactions
GraemeAllanBrycecommented, May 29, 2019

I would like to let people know that we have an app in production that is working perfectly using this library and AWS Pinpoint for both analytics and push notifications. It is working on iOS and Android.

Our discover was that this library provides everything that is required for push notifications.

you SHOULD NOT include the AWS push notifications library in your build. It is not required and does indeed create conflicts. We spent a lot of time trying to resolve the conflicts using many of the suggestions given here, some worked and some did not and all were complex. It was a lightbulb moment when we realised there is no need to resolve them - just don’t include the AWS Push library.

Long way round for a simple and elegant solution. 😃 . Hope this helps.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Getting Started with Push Notifications using AWS Amplify
In this post, we will provide an example of how to implement Push Notifications in your mobile apps using AWS Amplify and Amazon...
Read more >
@aws-amplify/pushnotification - npm
Push notifications category of aws-amplify. ... Start using @aws-amplify/pushnotification in your project by running `npm i ...
Read more >
React native Amplify AWS package conflicting firebase
In my react native project I earlier added aws amplify for push notification. After that I wanted to do analytics, so I added...
Read more >
Push Notifications - Getting started - React Native - Amplify Docs
Push Notifications category is integrated with AWS Amplify Analytics category to be able to track notifications. Make sure that you have configured the ......
Read more >
Setting up Android Push Notifications with AWS Amplify
Note: The AWS Amplify Push Notification documentation shows the line compile project(':@aws-amplify/pushnotification') I believe that's inserted by manually ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found