Building your application
Android
When building the project, Unity will directly generate an APK for you.
Google Play Services
We recommend you use the Google Play Services, as otherwise we aren’t able to access the Google Advertising ID. This will lead to limited ad inventory, as an increasing number of advertising campaigns require the identifier. This ID is also essential for tracking daily active users (DAU) on your app.
With Unity Plugin 8.0.0 we check your manifest for a Google Play Services entry, and warn you if we don’t find any:
open fyber settings menu
Google Play Services entry
If you click on the Add Google Play Services entry
button we’ll add the necessary declaration to your manifest:
<meta-data android:name="com.google.android.gms.version" android:value="@integer/google_play_services_version" />
Keep in mind that adding the line above to your manifest will require you to add Google Play Services lib
to your project. You copy the google-play-services_lib
project from your android sdk path (usually under Android/sdk/extras/google/google_play_services/libproject/google-play-services_lib
) to your Unity project under Plugins\Android
NOTE: With Google Play Services
revision 30
, Google has moved to the aar
format and no longer distributes its lib as a project. Unity only supports aar
starting on version [5.0.0
] (http://unity3d.com/unity/whats-new/unity-5.0). If you’re using a lower version of unity or having trouble integrating the Google Play Services aar
, we recommend you to get the last distributed lib project from google repository.
Android Manifest
With the Unity Plugin 8.0.0 we automatically add the necessary declarations to your manifest. If your app does not have a manifest yet we’ll add Unity’s default.
You can change this behavior (including feedback dialogs) on the Fyber’s Edit Settings
menu:
open fyber settings menu
toggle the checkboxes
You can then click the Check AndroidManifest button to make sure your manifest has the necesseray entries.
These are the Permissions, Activities and Service we’ll be adding to your manifest:
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.READ_NETWORK_STATE" />
<activity android:name="com.fyber.ads.OfferWallUnityActivity" android:configChanges="orientation|screenSize" />
<activity android:name="com.fyber.unity.ads.RewardedVideoUnityActivity" android:configChanges="screenSize|orientation" android:theme="@android:style/Theme.Translucent" android:hardwareAccelerated="true" />
<activity android:name="com.fyber.ads.interstitials.InterstitialActivity" android:configChanges="screenSize|orientation" android:theme="@android:style/Theme.Translucent" />
<service android:name="com.fyber.cache.CacheVideoDownloadService" android:exported="false" />
Mediation
If you are using one of the mediated networks, please make sure to also include the required Activity
declarations, as specified here:
- Rewarded Video networks
- Interstitial networks
Additional step: setting the correct attributes in your launching activity
When the user presses the home button during the display of an interstitial or a rewarded video followed by an attempt to open the application except from the “Recent applications” screen, the Fyber and mediated partner SDK can get into an inconsistent state where ads cannot be requested anymore in a given user session.
This happens because the mediated partner SDK fails to notify Fyber SDK that the ad was dimissed in the home button click event. We are working with our partners to fix that issue but you need to follow these instructions to avoid this issue.
This issue happens if your Unity app has a certain AndroidManifest.xml
configuration: the configuration to start from launcher to the UnityPlayerActivity
or UnityPlayerNativeActivity
.
In order to prevent from such behavior, you need to set the following attributes of your launching activity to these values:
android:clearTaskOnLaunch="false"
android:launchMode="standard"
or
android:clearTaskOnLaunch="false"
android:launchMode="singleTop"
As Unity forces default values that cause this unwanted behavior, you need to explicitly set these values in order to overcome the issue by following these steps:
- Export your game as an Android project. Select File → Build Settings → Player, then select Android on the left list, check the Google Android Project and finally export your project.
- Import generated project files to Eclipse.
- Open your application’s
AndroidManifest.xml
file. Add the mentioned above parameters to the activity that includes the<intent-filter>
entries. - Build your game from Eclipse.
- The issue should be resolved.
iOS
- Ensure your iOS deployment target is set to iOS 6.0 or newer.
-
Select Edit → Project Settings → Player, click on the iOS tab, and finally edit the Target iOS Version in the Optimization section.
-
- Unity will generate an Xcode project, but first it will prompt you for the desired name for this project. Enter the name and click Save. Once the project is generated, open it with Xcode.
- Build the Xcode project.