Facebook与谷歌玩游戏在Unity3d

Facebook与谷歌玩游戏在Unity3d

本文介绍了冲突与Android清单活动标签:Facebook与谷歌玩游戏在Unity3d的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

Facebook和谷歌都玩游戏的插件要求我android.intent.action.MAIN和android.intent.action.LAUNCHER在Android清单。但有取消等。
我是新来的移动开发。有什么解决方法吗?我能是做错了?

Both Facebook and Google Play Games plugins require that I use android.intent.action.MAIN and android.intent.action.LAUNCHER in the Android Manifest. But one cancels the other.I'm new to mobile development. Is there any workaround? What can I be doing wrong?

清单:

<application android:icon="@drawable/app_icon" android:label="@string/app_name" android:debuggable="false" android:name="com.soomla.store.SoomlaApp">

<intent-filter>

    <action android:name="android.intent.action.MAIN" />

    <category android:name="android.intent.category.LAUNCHER" />

    <action android:name="android.intent.action.MAIN" />

    <category android:name="android.intent.category.LAUNCHER" />

<activity android:name="com.bfsgooglegames.GoogleGamesUnityPlayerActivity" 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.bfsgooglegames.GoogleGamesUnityPlayerNativeActivity" android:label="@string/app_name" android:configChanges="fontScale|keyboard|keyboardHidden|locale|mnc|mcc|navigation|orientation|screenLayout|screenSize|smallestScreenSize|uiMode|touchscreen">

  <meta-data android:name="android.app.lib_name" android:value="unity" />

  <meta-data android:name="unityplayer.ForwardNativeEventsToDalvik" android:value="false" />

</activity>

<activity android:name="com.facebook.LoginActivity" android:screenOrientation="landscape" android:configChanges="keyboardHidden|orientation">

</activity>

<service android:name="com.soomla.billing.BillingService" />

<receiver android:name="com.soomla.billing.BillingReceiver">

  <intent-filter>

    <action android:name="com.android.vending.billing.IN_APP_NOTIFY" />

    <action android:name="com.android.vending.billing.RESPONSE_CODE" />

    <action android:name="com.android.vending.billing.PURCHASE_STATE_CHANGED" />

  </intent-filter>

<meta-data android:name="com.facebook.sdk.ApplicationId" android:value="\ 209458325882127" />

<meta-data android:name="com.google.android.gms.appstate.APP_ID" android:value="@string/app_id_games" />

推荐答案

是有解决方法!在Java中的主要活动类,可以将它添加到了的onActivityResult()方法:

Yes there is a workaround! In your main activity class in java, you can add this to the onActivityResult() method:

Session.getActiveSession()的onActivityResult(这一点,要求code,结果code,数据);

如果你没有访问 com.bfsgooglegames.GoogleGamesUnityPlayerActivity 的来源,是您正在使用的主要活动,您可以创建扩展了另一个类。例如:

if you don't have access to the source of com.bfsgooglegames.GoogleGamesUnityPlayerActivity which is the main activity you are using, you can create another class that extends that one. example:

import android.content.Intent;
import android.os.Bundle;
import com.facebook.Session;

public class MyMainUnityPlayerActivity extends com.bfsgooglegames.GoogleGamesUnityPlayerActivity {
  @Override
  protected void onCreate(Bundle arg0) {
    super.onCreate(arg0);
  }

  @Override
  public void onActivityResult(int requestCode, int resultCode, Intent data) {
    super.onActivityResult(requestCode, resultCode, data);
    Session.getActiveSession().onActivityResult(this, requestCode, resultCode, data);
  }
}

然后在你的Andr​​oidManifest.xml中,使用它作为你的主要活动。

Then in your AndroidManifest.xml, use that as your main activity.

这篇关于冲突与Android清单活动标签:Facebook与谷歌玩游戏在Unity3d的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

07-30 12:19