Reputation: 3444
I want to update my Activity UI inside onRewardedVideoAdClosed() if user Rewarded , but unable to update any view of my activity due to activity is destroying when rewarded video ad open,
If I'm doing anything wrong, then what? can anyone let me know? because same issue I'm getting in this SampleCode as well.
Upvotes: 1
Views: 741
Reputation: 456
If you are using Unity this also works!
You need to edit the AndroidManifest.xml template that can be found in:
OSX: ~/Applications/Unity/PlaybackEngines/AndroidPlayer/Apk/AndroidManifest.xml
Windows: installation\Editor\Data\PlaybackEngines\androidplayer
*See more details in this Unity Question
Here is my 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>
As you can see I added android:configChanges="orientation|screenSize"
to the activity.
Please note you could instead copy that AndroidManifest.xml file into your Assets/Plugins/Android folder as a per project solution, otherwise this will affect all your Unity projects (if I understand correctly).
Upvotes: 0
Reputation: 3444
Finally, I have fixed the issue,
Just added this property in my activity android:configChanges="orientation|screenSize"
Now my activity looks like
<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>
A nice sample is here
Upvotes: 1