与 android 清单上的活动标签冲突:Unity3d 中的 Facebook 和 Google Play 游戏 [英] Conflict with activity tags on android manifest: Facebook and Google Play Games in Unity3d

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

问题描述

Facebook 和 Google Play 游戏插件都要求我在 Android 清单中使用 android.intent.action.MAIN 和 android.intent.action.LAUNCHER.但一个取消另一个.我是移动开发的新手.有什么解决方法吗?我做错了什么?

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(this, requestCode, resultCode, data);

如果您无权访问 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);
  } 
}

然后在您的 AndroidManifest.xml 中,将其用作您的主要活动.

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

这篇关于与 android 清单上的活动标签冲突:Unity3d 中的 Facebook 和 Google Play 游戏的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆