react-native-fcm android通知无法正常工作
我是第一次使用
react-native-fcm,根据文档,我已经完成了所有链接工作,并使用firebase控制台中的云消息选项卡发送通知.
发送通知后状态变为完整,IOS工作正常(获取通知)但是android什么都没有出现. compileSdkVersion 26 buildToolsVersion "26.0.2" defaultConfig { applicationId "XXXXXX" minSdkVersion 21 targetSdkVersion 26 versionCode 39 versionName "1.91" ndk { abiFilters "armeabi-v7a","x86" } } 请帮助我,我正在寻找一个漫长但无法找到的解决方案.
我已经尝试了很多东西没有什么锻炼,然后我创建了一个新的项目firebase并反应原生.并且一切正在进行(获取通知)然后我开始检查我的旧项目文件和新文件,经过这么多实验我发现问题是工具:node =“replace”我添加了这个因为react-native- facebook-login(google上的一些解决方案我得到了一些错误). 现在请帮我解决这个Android代码如何写它因为我的假设是工具:node =“replace”覆盖我的fcm代码与Facebook登录一个根据this reference.我不能删除工具:node =“替换”其崩溃的应用程序刚点击app图标后. <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> 解决方法
即使你应该发布你的android / build.gradle甚至android / app / build.gradle的所有内容,我想帮你说你应该使用react-native-firebase因为react-native-fcm将不再收到新功能.
(编辑:李大同) 【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容! |