Search for "Android Class Name" in "AndroidManifest.xml" by Unity3D

When setting up the “Android Native App” in the Facebook app, they need the Android class name . If you created an Android APK from Unity3D, how do you know which class to use?

enter image description here

<?xml version="1.0" encoding="utf-8"?> <manifest xmlns:android="http://schemas.android.com/apk/res/android" android:installLocation="preferExternal" package="--------------" android:versionName="1.02" android:versionCode="8"> <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.unity3d.player.UnityPlayerProxyActivity" android:label="@string/app_name" android:configChanges="fontScale|keyboard|keyboardHidden|locale|mnc|mcc|navigation|orientation|screenLayout|screenSize|smallestScreenSize|uiMode|touchscreen" android:screenOrientation="landscape"> <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:label="@string/app_name" android:configChanges="fontScale|keyboard|keyboardHidden|locale|mnc|mcc|navigation|orientation|screenLayout|screenSize|smallestScreenSize|uiMode|touchscreen" android:screenOrientation="landscape"> </activity> <activity android:name="com.unity3d.player.UnityPlayerNativeActivity" android:label="@string/app_name" android:configChanges="fontScale|keyboard|keyboardHidden|locale|mnc|mcc|navigation|orientation|screenLayout|screenSize|smallestScreenSize|uiMode|touchscreen" android:screenOrientation="landscape"> <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.unity3d.player.VideoPlayer" android:label="@string/app_name" android:configChanges="fontScale|keyboard|keyboardHidden|locale|mnc|mcc|navigation|orientation|screenLayout|screenSize|smallestScreenSize|uiMode|touchscreen" android:screenOrientation="landscape"> </activity> <!-- ACTIVITIES --> <activity android:name="com.prime31.FacebookProxyActivity" /> <!-- META-DATA --> </application> <!-- PERMISSIONS --> <uses-permission android:name="android.permission.INTERNET" /> <uses-feature android:glEsVersion="0x00020000" /> <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" /> <uses-feature android:name="android.hardware.sensor.accelerometer" /> <uses-feature android:name="android.hardware.touchscreen" /> <uses-feature android:name="android.hardware.touchscreen.multitouch" android:required="false" /> <uses-feature android:name="android.hardware.touchscreen.multitouch.distinct" android:required="false" /> <uses-sdk android:minSdkVersion="8" android:targetSdkVersion="16" /> </manifest> 
+8
android facebook unity3d facebook-apps
source share
3 answers

This field should be your primary business (related to MAIN and LAUNCHER). In this case, I think it will be com.unity3d.player.UnityPlayerProxyActivity.

This is mainly necessary if you use your own deep links (therefore, the FB application can create an intent that directly triggers your activity). In this regard, any public activity in your application will work.

+4
source share

The main activity tag must contain an intent-filter tag with the action android.intent.action.MAIN and the category android.intent.category.LAUNCHER .

Description of the intent-filter tag (from the documentation):

Defines the types of intentions that relate to the action, service, or broadcast, the receiver can respond. An intent filter announces the capabilities of its parent component — what the activity or service can do and what types of broadcasts the receiver can handle. It opens the component for receiving intentions of the advertised type, while filtering out those that do not make sense for the component. Most of the contents of a filter are described by its <action> , <category> and <data> Subitems.

For a more detailed discussion of filters, see the Intent Filters and Intent Filters document, as well as the Intent Filters section of the introduction.

The main action of the Android application has a intent-filter with the LAUNCHER category, which basically says that the activity can "launch the application" (in other words, it is launch / write).

The activity tag should look something like this:

 <activity android:name="ActivityClassName" android:label="Activity title"> <!-- The intent filter --> <intent-filter> <!-- The action --> <action android:name="android.intent.action.MAIN"/> <!-- The category --> <category android:name="android.intent.category.LAUNCHER"/> </intent-filter> </activity> 

Looking at AndroidManifest.xml , you can conclude that the main asset of your application is com.unity3d.player.UnityPlayerProxyActivity Activity, because it contains an intent-filter that meets these criteria.

Good luck with the game!

+5
source share

The use of "UnityPlayerProxyActivity" no longer applies to all versions of unity. You may need to use "UnityPlayerActivity".

More details:

If you export an Android project from one, you can find three classes in src:

  • UnityPlayerActivity
  • UnityPlayerNativeActivity
  • UnityPlayerProxyActivity

"UnityPlayerProxyActivity" and "UnityPlayerNativeActivity" are deprecated after Unity 5.0 beta12, so you need to use "UnityPlayerActivity".

In Facebook mode, enter:

[tld.yourdomain.game] .UnityPlayerActivity

Replace the part [...] with the specifics of your application. Note: if you have plugins / extensions that work with your manifest, this may be different.

UPDATE: In new versions of the Facebook SDK for Unity (verified since 7.9.4), you can simply find “FacebookSettings” in your Assets folder and it will tell you which class name to use (for example, “com.facebook.unity.FBUnityDeepLinkingActivity ")).

0
source share

All Articles