-
Notifications
You must be signed in to change notification settings - Fork 0
Android InApp Unity Documentation

NOTES:
- The code samples in this document can be copy/pasted into your source code
- Please notice that steps 1-3 are mandatory
- If you have any questions, contact us via support@startapp.com
##Step 1, Adding the SDK package to your Unity project
In order to add StartApp SDK to your application please follow the following steps:
1. Unzip the SDK files to a temporary folder
2. Import StartAppAndroidUnitySDK-x.x.x.unitypackage as a Custom Package (or drag and drop it to your "Assets" folder under the "Project" Window)
3. Import all the package's items by pressing "All" and then "Import"

##Step 2, Updating your Manifest File
Update the manifest.xml (in the Android folders) as follow:
1. Under the 'manifest' node replace <package_name> with your real package name.
2. Make sure the following activities are declared under the <application> element.
<activity android:name="com.startapp.android.publish.list3d.List3DActivity"
android:hardwareAccelerated="true"
android:theme="@android:style/Theme.NoTitleBar.Fullscreen"/>
<activity android:name="com.startapp.android.publish.AppWallActivity"
android:theme="@android:style/Theme.Translucent.NoTitleBar.Fullscreen"
android:hardwareAccelerated="true"
android:configChanges="orientation|keyboardHidden|screenSize" />
##Step 3, Updating your StartApp data file
Update the StartAppData.txt (in the Assets/Resources folders) as follows:
1. Add your StartApp Developer ID after developerId=
2. Add your StartApp Application ID after applicationId=
You can find your Developer and Application IDs in the developers’ portal.
After logging in, your developer ID will be at the top right-hand corner of the page:

To find your application ID, click on the
at the top of the main screen and then choose the relevant ID from your app list:

##Adding an exit ad to your project
Use the StartAppBackPlugin in components where you would like the user to press 'back' to exit the application. The plugin will show an ad and then exit the application.
1. Drag the StartAppBackPlugin.cs to the components which you would like pressing 'back' to exit the application
2. Do not implement exit on the 'back' in this components
NOTE: there is no need to implement exit on the 'back' button in these components as the plugin will exit the application after showing the ad.
##Showing Banners
To add a banner to your application add the following code in the appropriate place:
1. Import the SDK namespace
using StartApp;2. Display the banner
void Start () {
#if UNITY_ANDROID
StartAppWrapper.addBanner(
StartAppWrapper.BannerType.AUTOMATIC,
StartAppWrapper.BannerPosition.BOTTOM);
#endif
}Parameters
BannerPosition - position of the banner. Can receive one of the following:
StartAppWrapper.BannerPosition.BOTTOM
StartAppWrapper.BannerPosition.TOP
For advanced usage, such as showing a specific banner type or hiding the banner, please refer to the Advanced Usage.
You can choose to show the interstitial ad in several locations within your application. This could be upon entering (onCreate), between stages, while waiting for an action and more.
We do, however, recommend showing the ad upon exiting the application by using the ‘Back’ button or the ‘Home’ button, as explained in step 4 above.
Add the following code to the appropriate place or places within your activities in which you would like to show the ad:
1. Import the sdk namespace
using StartApp;2. Load the ad
void Start () {
#if UNITY_ANDROID
StartAppWrapper.loadAd();
#endif
}3. Show the ad
#if UNITY_ANDROID
StartAppWrapper.showAd();
StartAppWrapper.loadAd();
#endif