I am using react-native-fcm first time and according to documentation i have done all the linking stuff and using cloud messaging tab in firebase console for sending notification.
After sending notification status comes as complete and for IOS its working fine(getting notification) but android nothing is coming up. I am using mi device for testing that is having android N This is my build.gradle settings.
compileSdkVersion 26
buildToolsVersion "26.0.2"
defaultConfig {
applicationId "XXXXXX"
minSdkVersion 21
targetSdkVersion 26
versionCode 39
versionName "1.91"
ndk {
abiFilters "armeabi-v7a", "x86"
}
}
Please help me out i am searching from a long but unable to find solution. Advance Thanks!!!
Edit after some experiments on 8/6/2018
i've tried so many things nothing workout then i have created an new project firebase and react native as well. and everything is working on that (getting notification) then i start checking my old project files and new files and after so many experiments i found out the issue is with tools:node="replace"
i have added this because of react-native-facebook-login
(some solutions on google some error i got).
now please help me with this android code how to write it because my assumption is that tools:node="replace"
is overriding my fcm code with Facebook login one according to this reference. i cant remove tools:node="replace"
its crashing app just after clicking app icon.
<application
tools:node="replace" <-- this is culprit
android:name=".MainApplication"
android:label="@string/app_name"
android:icon="@mipmap/ic_launcher"
android:allowBackup="false"
android:theme="@style/AppTheme">
<receiver android:name="com.evollu.react.fcm.FIRLocalMessagingPublisher"/>
<receiver android:enabled="true" android:exported="true" android:name="com.evollu.react.fcm.FIRSystemBootEventReceiver">
<intent-filter>
<action android:name="android.intent.action.BOOT_COMPLETED"/>
<action android:name="android.intent.action.QUICKBOOT_POWERON"/>
<action android:name="com.htc.intent.action.QUICKBOOT_POWERON"/>
<category android:name="android.intent.category.DEFAULT" />
</intent-filter>
</receiver>
<!-- <meta-data android:name="com.google.firebase.messaging.default_notification_icon" android:resource="@mipmap/icon"/> -->
<service android:name="com.evollu.react.fcm.MessagingService" android:enabled="true" android:exported="true">
<intent-filter>
<action android:name="com.google.firebase.MESSAGING_EVENT"/>
</intent-filter>
</service>
<service android:name="com.evollu.react.fcm.InstanceIdService" android:exported="false">
<intent-filter>
<action android:name="com.google.firebase.INSTANCE_ID_EVENT"/>
</intent-filter>
</service>
<activity
android:name=".MainActivity"
android:label="@string/app_name"
android:launchMode="singleTop"
android:screenOrientation="portrait"
android:configChanges="keyboard|keyboardHidden|orientation|screenSize"
android:windowSoftInputMode="adjustPan">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity android:screenOrientation="portrait" android:name="com.facebook.react.devsupport.DevSettingsActivity" />
<!--add FacebookActivity-->
<activity
tools:replace="android:theme"
android:screenOrientation="portrait"
android:name="com.facebook.FacebookActivity"
android:configChanges="keyboard|keyboardHidden|screenLayout|screenSize|orientation"
android:label="@string/app_name"
android:theme="@android:style/Theme.Translucent.NoTitleBar"/>
<!--add CustomTabActivity-->
<activity
android:screenOrientation="portrait"
android:name="com.facebook.CustomTabActivity"
android:exported="true">
<intent-filter>
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.DEFAULT" />
<category android:name="android.intent.category.BROWSABLE" />
<data android:scheme="@string/fb_login_protocol_scheme" />
</intent-filter>
</activity>
<!--reference your fb_app_id-->
<meta-data
android:name="com.facebook.sdk.ApplicationId"
android:value="@string/fb_app_id"/>
<meta-data android:name="com.bugsnag.android.API_KEY"
android:value="xxxxxxxxxxxxxx"/>
</application>