1: Copy mg_android_sdk.aar under sdk to the game project Assets\Plugins\Android directory.
2: Copy the jar under sdk/libs to the game project Assets\Plugins\Android\libs directory.(If you are using the AndroidX library sdk, skip this step!)
3: In the game code in accordance with this document combined with the game to achieve the relevant logic
Specifically, you can refer to the AndroidManifest.xml configuration in the demo.
Add permission statements inside <manifest></manifest>
<!-- Query application by package name --> <uses-permission android:name="android.permission.QUERY_ALL_PACKAGES" tools:ignore="QueryAllPackagesPermission" /> <!-- Access to network connection, may generate GPRS traffic --> <uses-permission android:name="android.permission.INTERNET" /> <!-- Get the status of network information, such as whether the current network connection is active or not --> <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" /> <!-- Change WiFi status --> <uses-permission android:name="android.permission.CHANGE_WIFI_STATE" /> <!-- Get the status of the current WiFi access and information about the WLAN hotspot --> <uses-permission android:name="android.permission.ACCESS_WIFI_STATE" /> <!-- Read and write cell phone status and identity --> <uses-permission android:name="android.permission.READ_PHONE_STATE" /> <uses-permission android:name="android.permission.READ_PRIVILEGED_PHONE_STATE" /> <!-- Allowed to be displayed in the upper layers of other applications --> <uses-permission android:name="android.permission.SYSTEM_ALERT_WINDOW" /> <!-- Allows program to write to external storage, e.g., write file on SD card --> <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" /> <!-- Google Play IAB --> <uses-permission android:name="com.android.vending.BILLING" />
<!-- MG user center required activity --> <activity android:name="com.mg.usercentersdk.widget.WrapperActivity" android:configChanges="fontScale|orientation|keyboardHidden|locale|navigation|screenSize|uiMode" android:excludeFromRecents="true" android:hardwareAccelerated="false" android:launchMode="standard" android:theme="@android:style/Theme.Translucent.NoTitleBar.Fullscreen" android:windowSoftInputMode="stateAlwaysHidden|adjustResize" > </activity> <!-- MG User Center AppKey --> <meta-data android:name="AppKey" android:value="28F92A14A7" > </meta-data> <!-- MG User Center Channel Number --> <meta-data android:name="ChannelID" android:value="mg" > <!--Different channels out of package configuration--> </meta-data> <!-- Game type representation --> <meta-data android:name="SINGLE_GAME" android:value="true" > <!--true for single player games false for online games--> </meta-data> <!-- Script object for handling SDK callback messages in Unity --> <meta-data android:name="MIRACLE_GAMES_UNITY3D_OBJECT_NAME" android:value="MiracleGames" /> <!-- WeChat Login Required configurations, optional configurations according to project requirements --> <activity android:name="com.mg.game.jqyct.wxapi.WXEntryActivity" android:theme="@android:style/Theme.Translucent.NoTitleBar" android:exported="true" android:launchMode="singleTop"> </activity> <!-- Parameters required for WeChat login --> <meta-data android:name="wx_appid" android:value="wx1ef681931f302080" > </meta-data> <meta-data android:name="wx_secret" android:value="720489607754132afb1481df767f5009" > </meta-data> <!-- QQ login Required configuration, optional configuration according to project requirements--> <activity android:name="com.tencent.tauth.AuthActivity" android:configChanges="orientation|keyboardHidden" android:noHistory="true" android:launchMode="singleTask" > <intent-filter> <action android:name="android.intent.action.VIEW" /> <category android:name="android.intent.category.DEFAULT" /> <category android:name="android.intent.category.BROWSABLE" /> <data android:scheme="tencent101946544" /> </intent-filter> </activity> <activity android:name="com.tencent.connect.common.AssistActivity" android:configChanges="orientation|keyboardHidden|screenSize" android:screenOrientation="behind" android:theme="@android:style/Theme.Translucent.NoTitleBar" /> <meta-data android:name="qq_appid" android:value="tencent101946544" > </meta-data> <!-- Facebook Required Activity, optionally configurable according to project requirements --> <meta-data android:name="com.facebook.sdk.ApplicationId" android:value="@string/facebook_app_id"/> <activity android:name="com.facebook.FacebookActivity" android:configChanges="keyboard|keyboardHidden|screenLayout|screenSize|orientation" android:label="@string/app_name" /> <activity android:name="com.facebook.CustomTabActivity" android:exported="true"> <intent-filter> <action android:name="android.intent.action.VIEW" /> <category android:name="android.intent.category.DEFAULT" /> <category android:name="android.intent.category.BROWSABLE" /> <data android:scheme="@string/fb_login_protocol_scheme" /> </intent-filter> </activity> <!-- Google Login Required configuration, optional configuration based on project requirements --> <!-- Google Client ID --> <meta-data android:name="SERVER_CLIENT_ID" android:value="545888706329-mtpbbnjn1h8uaeb3lt3hgcot5f118jce.apps.googleusercontent.com" > </meta-data> <meta-data android:name="com.google.android.gms.version" android:value="@integer/google_play_services_version" /> <!-- GoogleLogin Required Activity --> <activity android:excludeFromRecents="true" android:exported="false" android:name="com.google.android.gms.auth.api.signin.internal.SignInHubActivity" android:theme="@android:style/Theme.Translucent.NoTitleBar"/>
Modify the game main entry activity to "com.mg.usercentersdk.MGUnityActivity".
Set the attribute of android:screenOrientation according to the horizontal and vertical screen of the game, if the game is vertical screen, please change it to protrait; if the game is horizontal screen, please change it to landscape.