如果用户获得奖励,我希望更新onRewardedVideoAdClosed()中的活动UI,但当奖励视频广告打开时,由于活动正在破坏,我无法更新我的活动视图,
如果我做错了什么,那又怎样?有人能告诉我吗?因为我在这个SampleCode中也遇到了同样的问题。
发布于 2017-06-01 05:46:53
最后,我修复了这个问题,只是在活动android:configChanges="orientation|screenSize"
中添加了这个属性。
现在我的活动看上去像是
<activity
android:name=".MainActivity"
android:configChanges="orientation|screenSize"
android:label="@string/app_name">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
一个不错的样品在这里
发布于 2018-04-13 18:13:01
如果您使用的是统一,这也是有效的!
您需要编辑可以在以下文件中找到的AndroidManifest.xml模板:
OSX:~/Applications/Unity/PlaybackEngines/AndroidPlayer/Apk/AndroidManifest.xml
Windows:installation\Editor\Data\PlaybackEngines\androidplayer
*请参阅本统一性问题中的详细信息
这是我的AndroidManifest.xml
<?xml version="1.0" encoding="utf-8"?>
<manifest
xmlns:android="http://schemas.android.com/apk/res/android"
package="com.unity3d.player"
xmlns:tools="http://schemas.android.com/tools"
android:installLocation="preferExternal"
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:theme="@style/UnityThemeSelector"
android:icon="@drawable/app_icon"
android:label="@string/app_name">
<activity android:name="com.unity3d.player.UnityPlayerActivity"
android:label="@string/app_name"
android:configChanges="orientation|screenSize">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
<meta-data android:name="unityplayer.UnityActivity" android:value="true" />
</activity>
</application>
</manifest>
如您所见,我将android:configChanges="orientation|screenSize"
添加到活动中。
请注意,您可以将该AndroidManifest.xml文件复制到您的资产/Plugins/Android文件夹中,作为每个项目的解决方案,否则将影响您的所有统一项目(如果我正确理解的话)。
https://stackoverflow.com/questions/44281827
复制相似问题