简体   繁体   中英

Facebook Unity SDK v5.0.4 - Trouble with login with mobile device

Some days ago, I used Facebook Unity SDK v5.0.3 and I tested successfully on my Android phone. But today I add another multi-platform plugin to my project(revmob-advertise), so it change my Androidmanifest.xml. Then I can't login using my Facebook Profile. I re-import the newest Facebook Unity Package and I think there may be some problems that I don't know because I changed my Manifest and build several times and the result wasn't change. This is my Android Manifest, please help me figure out my problem.

<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android" package="com.unity3d.player" android:installLocation="preferExternal" android:theme="@android:style/Theme.NoTitleBar" android:versionCode="1" android:versionName="1.0">
  <supports-screens android:smallScreens="true" android:normalScreens="true" android:largeScreens="true" android:xlargeScreens="true" android:anyDensity="true" />
  <application android:icon="@drawable/app_icon" android:label="@string/app_name" android:debuggable="true">
    <activity android:name="com.facebook.unity.FBUnityPlayerActivity" android:launchMode="singleTask" android:label="@string/app_name" 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>
    </activity>
    <activity android:name="com.unity3d.player.UnityPlayerActivity" android:launchMode="singleTask" android:label="@string/app_name" android:configChanges="fontScale|keyboard|keyboardHidden|locale|mnc|mcc|navigation|orientation|screenLayout|screenSize|smallestScreenSize|uiMode|touchscreen">
    </activity>
    <activity android:name="com.unity3d.player.UnityPlayerNativeActivity" android:launchMode="singleTask" android:label="@string/app_name" android:configChanges="fontScale|keyboard|keyboardHidden|locale|mnc|mcc|navigation|orientation|screenLayout|screenSize|smallestScreenSize|uiMode|touchscreen">
      <meta-data android:name="unityplayer.ForwardNativeEventsToDalvik" android:value="false" />
    </activity>
    <activity android:name="com.facebook.LoginActivity" android:configChanges="keyboard|orientation|screenSize" android:theme="@android:style/Theme.Translucent.NoTitleBar">
    </activity>
    <meta-data android:name="com.facebook.sdk.ApplicationId" android:value="\ 267548153412434" />
    <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>
    <activity android:name="com.facebook.unity.FBUnityDeepLinkingActivity" android:exported="true">
    </activity>
  </application>
</manifest>

Facebook Unity SDK no longer requires to use main activity, so just use UnityPlayerActivity with "MAIN" action intent-filter or whatever your plugin needs to use but make sure your manifest file contains:

  • ApplicationId
  • LoginActivity
  • FBUnityLoginActivity
  • FBUnityDeepLinkingActivity

so just add this to manifest that whatever plugin you are using generated

    <activity android:name="com.facebook.LoginActivity" android:configChanges="keyboard|orientation|screenSize" android:theme="@android:style/Theme.Translucent.NoTitleBar">
    </activity>
    <meta-data android:name="com.facebook.sdk.ApplicationId" android:value="\ 267548153412434" />
    <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>
    <activity android:name="com.facebook.unity.FBUnityDeepLinkingActivity" android:exported="true">
    </activity>

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM