我已经尝试了快速入门-unity-master的消息传递应用程序,它本身工作正常,但是当我添加Facebook插件时,发生了以下情况:
火力基础 FCM 初始化成功,但我不再收到OnMessageReceived
和OnTokenReceived
。
这可能与com.google.firebase.MessagingUnityPlayerActivity
活动未收到事件有关,但我不确定出了什么问题,因为添加 facebook 后 Android 清单仍然相同。
我正在使用脸书 7.10.1
这是我的安卓清单
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" package="${applicationId}" android:versionCode="1" android:versionName="1.0">
<application android:label="@string/app_name" android:icon="@drawable/app_icon">
<!-- The MessagingUnityPlayerActivity is a class that extends
UnityPlayerActivity to work around a known issue when receiving
notification data payloads in the background. -->
<activity android:name="com.google.firebase.MessagingUnityPlayerActivity" android:label="@string/app_name" android:icon="@drawable/app_icon" android:configChanges="fontScale|keyboard|keyboardHidden|locale|mnc|mcc|navigation|orientation|screenLayout|screenSize|smallestScreenSize|uiMode|touchscreen">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
<meta-data android:name="unityplayer.UnityActivity" android:value="true" />
</activity>
<service android:name="com.google.firebase.messaging.MessageForwardingService" android:exported="false" />
<activity android:name="com.facebook.unity.FBUnityLoginActivity" android:configChanges="fontScale|keyboard|keyboardHidden|locale|mnc|mcc|navigation|orientation|screenLayout|screenSize|smallestScreenSize|uiMode|touchscreen" android:theme="@android:style/Theme.Translucent.NoTitleBar.Fullscreen" />
<activity android:name="com.facebook.unity.FBUnityDialogsActivity" android:configChanges="fontScale|keyboard|keyboardHidden|locale|mnc|mcc|navigation|orientation|screenLayout|screenSize|smallestScreenSize|uiMode|touchscreen" android:theme="@android:style/Theme.Translucent.NoTitleBar.Fullscreen" />
<activity android:name="com.facebook.unity.FBUnityAppLinkActivity" android:exported="true" />
<activity android:name="com.facebook.unity.FBUnityDeepLinkingActivity" android:exported="true" />
<activity android:name="com.facebook.unity.FBUnityGameRequestActivity" />
<activity android:name="com.facebook.unity.FBUnityCreateGameGroupActivity" />
<activity android:name="com.facebook.unity.FBUnityJoinGameGroupActivity" />
<activity android:name="com.facebook.unity.AppInviteDialogActivity" />
<meta-data android:name="com.facebook.sdk.ApplicationId" android:value="fb11111111111111" />
<provider android:name="com.facebook.FacebookContentProvider" android:authorities="com.facebook.app.FacebookContentProvider233093877143960" android:exported="true" />
</application>
</manifest>
感谢您的帮助
问题是缺少一些依赖项,起初我只包含两个SDK所需的内容并分别尝试了它们,它们工作了,但由于某种原因一起不起作用;
解决方案是将构建系统从内部切换到 Gradle ,然后您不必担心最大 DEX 方法,您可以让 Google Play 解析器下载所有需要的 JAR 和 AAR;