tinycreative / react-native-intercom

React Native wrapper for Intercom.io
MIT License
406 stars 280 forks source link

[ANDROID] - Migration GCM to FCM, and OneSignal potential conflicts ? #302

Closed MayoudP closed 2 years ago

MayoudP commented 5 years ago

So i'm currently trying to migrate my react-native project from GCM to FCM. I followed all the steps of the documentation, but didn't received any notifications when I tried it. If I'm sending Push Notifications directly from Firebase, it's working. However, if I try from Intercom, it's not working (I changed the API Key with the firebase one).

Here is my build.gradle :

buildscript {
    repositories {
        google()
        jcenter()
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:3.1.4'
        classpath 'com.google.gms:google-services:4.2.0'
        // NOTE: Do not place your application dependencies here; they belong
        // in the individual module build.gradle files
    }
}

allprojects {
    repositories {
    // Add jitpack repository (added by react-native-spinkit)
    maven { url "https://jitpack.io" }
        maven {url "https://maven.google.com" }
        mavenLocal()
         configurations.all {
        resolutionStrategy.eachDependency { DependencyResolveDetails details ->
            def requested = details.requested
            if (requested.group == 'com.google.android.gms') {
                details.useVersion '12.0.1'
            }
                if (requested.group == 'com.google.firebase') {
                details.useVersion '12.0.1'
                }
            }
        }
        jcenter()
        google()
        maven {
            // All of React Native (JS, Obj-C sources, Android binaries) is installed from npm
            url "$rootDir/../node_modules/react-native/android"
        }
    }
}

The dependencies I used in the app/build.gradle :

dependencies {
implementation 'com.android.support:appcompat-v7:28.0.0'
    implementation 'com.android.support:design:28.0.0'
    implementation 'com.android.support:animated-vector-drawable:28.0.0'
    implementation 'com.android.support:support-vector-drawable:28.0.0'
    implementation 'com.android.support:support-v4:28.0.0'
    implementation 'com.android.support:support-annotations:28.0.0'
    implementation 'com.google.android.gms:play-services-analytics:12.0.1'
    implementation 'com.google.firebase:firebase-core:16.0.9'
    implementation 'com.facebook.react:react-native:+'
    implementation project(':bugsnag-react-native')
    implementation project(':react-native-google-analytics-bridge')
    implementation 'io.intercom.android:intercom-sdk-fcm:5.+'
    implementation 'com.google.firebase:firebase-messaging:17.+'

    // From node_modules
    implementation 'com.mixpanel.android:mixpanel-android:5.+'
    implementation 'com.facebook.fresco:fresco:1.10.0'
    implementation 'com.facebook.fresco:animated-gif:1.10.0'
    androidTestCompile 'tools.fastlane:screengrab:1.0.0'
}

I'm wondering if using one-signal could make some conflicts with intercom ? But I'd get some warning if so, nop ? I was using GCM before, so I well initialized in the MainApplication Intercom.initialize(...)

And since Push Notifications directly sent from Firebase works, I guess that it's not a problem from the setup of FCM, but that it's more coming from the Intercom one... Am I missing something ?

Thank's for the help you could provide,

MayoudP commented 5 years ago

Before, using react-native-onesignal and push notifications on Android through GCM was working well. Now that I switch android Push Notifications from Intercom with FCM, does it mean that I need to include a FirebaseMessagingService ?

slorber commented 4 years ago

Hey, also having problems that seems related to migrating from GCM to FCM, just wanted to link to my reporting here: https://github.com/tinycreative/react-native-intercom/issues/307#issuecomment-582045154