Manual Integration with JAR File

SDK Version: 4.9.2

If you are upgrading the SDK from an older version, you have to repeat step 1 and re-import all effected classes. 

This document describes the basic procedure for integrating Start.io (Formerly StartApp) In-App Ads into your Android applications.

After this simple integration process, Start.io In-App Ads enables you to reap the benefits of Start.io's In-App monetization products, which maximize the revenue generated by your application. All this profit-making is achieved with minimal effort and minimal interference with your users' experience.

NOTES:
  • The code samples in this document can be copy/pasted into your source code
  • Feel Free to check out our sample project as a reference
  • We strongly recommend you incorporate Integration Tests during the integration and before going live
  • Please notice that steps 1-3 bellow are mandatory
  • If you have any questions, contact us here.

Getting Started

Step 1, Adding and Initializing the SDK to Your Project

Manual (Jar)

For manual installation please follow the below instructions, note we offer Manifest or Code based initialization to suit your needs

IMPORTANT NOTE:
  • You should implement only one of the initialization methods below based on your preference.
AndroidManifest.xml Initialization Code Initialization
1. Downloading the SDK

If you are not using jCenter, you can download the SDK zip file and add the Start.io InApp-x.x.x.jar file to the “libs” directory of your project (you can find the latest version in our portal).

2. Updating Your AndroidManifest.xml File

Add the following permissions under the main <manifest> element.
Bluetooth permission is optional:

<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.ACCESS_WIFI_STATE" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED" />
<uses-permission android:name="android.permission.BLUETOOTH" />
<uses-permission android:name="com.google.android.finsky.permission.BIND_GET_INSTALL_REFERRER_SERVICE" />
<queries>
<intent>
<action android:name="android.intent.action.MAIN" />
</intent>
</queries> />
Applications targeting API level 31 (Android 12 and up) should also include the following permission on their <manifest> to allow access to the Android Advertiser Identifier:
<uses-permission android:name="android.permission.Ad_ID" />

Add the following android's components under the <application> section:

<provider
android:name="com.startapp.sdk.adsbase.StartAppInitProvider"
android:authorities="${applicationId}.startappinitprovider"
android:exported="false" />
<activity
android:name="com.startapp.sdk.adsbase.consent.ConsentActivity"
android:configChanges="orientation|screenSize|screenLayout|keyboardHidden"
android:theme="@android:style/Theme.Translucent"/>
<activity
android:name="com.startapp.sdk.ads.list3d.List3DActivity"
android:theme="@android:style/Theme"/>
<activity
android:name="com.startapp.sdk.ads.interstitials.OverlayActivity"
android:configChanges="orientation|screenSize|screenLayout|keyboardHidden"
android:theme="@android:style/Theme.Translucent"/>
<service android:name="com.startapp.sdk.cachedservice.BackgroundService" />
<service
android:name="com.startapp.sdk.jobs.SchedulerService"
android:permission="android.permission.BIND_JOB_SERVICE" />
<receiver android:name="com.startapp.sdk.adsbase.remoteconfig.BootCompleteListener">
<intent-filter>
<action android:name="android.intent.action.BOOT_COMPLETED"/>
</intent-filter>
</receiver>
Add following meta-data tag with Start.io (Formerly StartApp) App Id under the <application> section in your manifest file:
<meta-data
android:name="com.startapp.sdk.APPLICATION_ID"
android:value="startapp_app_id" />

Replace "APPLICATION_ID" with your own value provided in the developers’ portal

To find your application ID, click on the "My Apps" tab on the left pane and choose the relevant ID from your app list:

App_ID.png

If you want to disable return ads (they are enabled by default) please add following meta-data tag:
<meta-data
android:name="com.startapp.sdk.RETURN_ADS_ENABLED"
android:value="false" />

Step 2, Obfuscation (Mandatory for Proguard users)

Obfuscation protects an application from reverse-engineering or modification by making it harder for a third-party to access your source (decompiled) code.

Start.io (Formerly StartApp)  In-Ad is already obfuscated! Therefore, if you did not obfuscate your application using ProGuard™, then you can skip this step. If you have obfuscated your application using ProGuard, then use the following in the ProGuard configuration file:

-keep class com.startapp.** {
      *;
}

-keep class com.truenet.** {
      *;
}

-keepattributes Exceptions, InnerClasses, Signature, Deprecated, SourceFile,
LineNumberTable, *Annotation*, EnclosingMethod
-dontwarn android.webkit.JavascriptInterface
-dontwarn com.startapp.**

-dontwarn org.jetbrains.annotations.**

Step 3, App Permissions (COPPA Compliant)

In case your app target children (as defined under applicable laws, such as 13 in the US and 16 in the EU) and you integrated the SDK version through jCenter, you need to remove the WIFI permission from your manifest merger. In order to do so, follow these steps:

  1. Add this line to the manifest element:
    xmlns:tools="http://schemas.android.com/tools"
  2. Add this line to your permission list:
    <uses-permission android:name="android.permission.ACCESS_WIFI_STATE" tools:node="remove"/>

 

Regulation Advanced Settings

Start.io Consent 

We help you to be compliant with Privacy laws, when embedding our SDK.

Privacy laws require to disclose to the app users that Start.io (Formerly StartApp) SDK is embedded in your app and collects and processes their personal data for the purpose of displaying personalized advertising. In some jurisdictions, users’ consent is required as well. We embedded a disclosure / consent box which will be presented to the app users and will enable them to review Start.io Privacy Policy, as well as exercise their rights.

Start.io disclosure/ consent box is presented immediately after the application is launched. Start.io disclosure/ consent box is enabled by default. 

Consent From European Users (GDPR) 

In addition to Start.io (Formerly StartApp) disclosure / consent box, as required under GDPR, you should report to us users’ consent by consent flag (“pas”), via the API detailed herein below,.

The user consent flag indicates whether a user based in the EU has provided consent for sharing his app data for the purpose of ads personalization. Based on this consent flag, Start.io will target the most relevant ads to your users. If a user has not consented, we will not show personalized ads to this user.

IMPORTANT NOTES:
  • Collection of consent is only required in countries covered by GDPR (EU member states). Consent is not required for users that are based outside those countries.
  • We recommend you to pass the consent flag to Start.io (Formerly StartApp) right after initializing the SDK.
  • In case of any consent change during the lifetime of the user activity, you are required to re-submit the relevant consent flag to Start.io.
  • Older SDK versions (before 3.9.3): We'll continue to support them with showing ads. It’s important to know that in case you cannot update the SDK version and the user consent is false for GDPR users, do not initialize Start.io SDK for such users.

Use this method in case the user has consented:

StartAppSDK.setUserConsent (this,  
                            "pas",
                            System.currentTimeMillis(),                        
                            true);

Use this method in case the user has not consented:

StartAppSDK.setUserConsent (this,  
                            "pas",
                            System.currentTimeMillis(),                        
                            false);

NOTE: timestamp parameter should represent the specific time a consent was given by the user.

To make the process easier, we have added a consent window to our demo apps. Please follow the link to see demo projects. 

CCPA Compliance

Start.ios SDK (Version 4.9.0 and above) supports publishers to restrict the sale of end users personal information under the California Consumer Privacy Act (CCPA).

The notification about opt out of specific users located in California should be handled based on IAB US Privacy String.

To set the IAB US privacy string, use the following API:

StartAppSDK.getExtras(this)  
      .edit()
      .putString("IABUSPrivacy_String", "1YNN")
      .apply(); 

To determine what value to use for the US Privacy String, refer to IAB document. Note that it is case-sensitive.
Example values:

  • When CCPA does not apply (for example if the user is not a resident of California) you can either skip this API or use the following value “1---".
  • If the user chooses NOT to opt out, and is ok with advertising as usual, you can use "1YNN".
  • If the user chooses to restrict advertising and opt out, you can use "1YYN".

For more information on Start.io and CCPA, refer to Start.io’s Blog Page.

Ad Formats

Splash Ad (recommended)

Start.io (Formerly StartApp) Splash Ad is a top performing ad unit, presenting the industry's highest CPM's

A Splash Ad is a full-page ad that is displayed immediately after the application is launched. A Splash Ad first displays a full page splash screen that you define (as described below) followed by a full page ad.

The Splash Ad is enabled by default. If you want to disable it simply call StartAppAd.disableSplash() after calling StartAppSDK.init.

By default, your application will be using a pre-defined splash screen designed by Start.io. If you want to customize this screen or if you already have your own splash screen and want to use it, please refer to the Advanced Usage.

Return Ad

The Return Ad is a new ad unit which is displayed once the user returns to your application after a certain period of time. To minimize the intrusiveness, short time periods are ignored.

Return ads are enabled and activated by default. If you want to disable this feature, simply pass "false" as the 3th parameter of the StartAppSDK.init method:

StartAppSDK.init(this, "StartApp App ID", false);

 

Interstitial Ads

Interstitial Ads are full page ads, displayed before or after a certain content page or action, such as upon entering a stage, between stages, while waiting for an action, upon exiting the application and more. There are three ways of integrating Interstitial Ads:
Exit Ads - show an ad upon exiting your application
Standard Interstitial Ads - show an ad at a specific location(s) in your application
Autostitial Ads - show an ad automatically between activities

Exit Ads

To show an ad upon exiting your application when pressing the 'Back' button, override the onBackPressed() method and add the method StartAppAd.onBackPressed(this) BEFORE the method super.onBackPressed() (this is the activity/application context):

@Override
public void onBackPressed() {
    StartAppAd.onBackPressed(this);
    super.onBackPressed();
}

Standard Interstitials

Use the showAd()  method to show an Interstitial Ad at a specific location inside your app.

Call StartAppAd.showAd(this) in the appropriate place(s) in the activity where you would like to show the Ad. The showAd method returns true in case the ad was displayed successfully, or false if not (for example, if an ad isn't ready yet).

The following is an example of showing an Interstitial Ad between Activities:

public void btnOpenActivity (View view){
    Intent nextActivity = new Intent(this, NextActivity.class);
    startActivity(nextActivity);
    StartAppAd.showAd(this);
}

Please notice - If you want to use Autostitial Ads and yet to show an Interstitial in a specific location, call StartAppAd.disbleAutoInterstitial(); before calling StartAppAd.showAd, otherwise two ads might be displayed together. Remember to call StartAppAd.enableAutoInterstitial(); afterthat to reanable Autostitial Ads.

IMPORTANT:

Loading an ad might take a few seconds. In case you call showAd() while the ad hasn't been successfully loaded yet, nothing will be displayed. If you want to show an ad when your application is launched, use our "Splash Ad". You can also implement your interstitial ad as an object and use the "onReceiveAd" callback which is triggered when an ad was loaded and ready to use. See"Interstitial Ads"under the "Advanced Usage" section.

Autostitials

"Autostitial" stands for "Auto Interstitial"; use this integration to show an Interstitial Ad each time an activity is changed.
Simply call StartAppAd.enableAutoInterstitial(); after calling StartAppSDK.init. You can gain more control over the frequency of Autostitial Ads using two methods: time frequency and activity frequency.

Time Frequency

You can set a minimum time interval between consecutive Autostitial Ads.
For example, set a 1 minute interval between two consecutive ads (time in seconds):

StartAppAd.setAutoInterstitialPreferences(
                  new AutoInterstitialPreferences()
                  .setSecondsBetweenAds(60)
           );

Activity Frequency

You can set a minimum number of activities between consecutive Autostitial Ads.
For example, show an Autostitial after each 3 activities:

StartAppAd.setAutoInterstitialPreferences(
                  new AutoInterstitialPreferences()
                  .setActivitiesBetweenAds(3)
           );

Time frequency and activity frequency can be used together.

Banner Ads

Add the following View inside your Activity layout XML

<com.startapp.sdk.ads.banner.Banner
android:id="@+id/startAppBanner"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerHorizontal="true" />
 NOTE:

This code places a View inside your Activity. You also have the option to add additional attributes for placing it in the desired location in your Activity.

For a full integration guide, please refer to the Advanced Usage page.

MRec Ads

MRec is a 300X250 rectangular ad integrated within an app's layout. The ad will be refreshed automatically.

Add the following View inside your Activity layout XML:

<com.startapp.sdk.ads.banner.Mrec
android:id="@+id/startAppMrec"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerHorizontal="true" />
NOTE:

This code places a View inside your Activity. You also have the option to add additional attributes for placing it in the desired location in your Activity.

For adding MRec programmatically, instead of using the layout XML:

// Get the Main relative layout of the entire activity
RelativeLayout mainLayout = (RelativeLayout)findViewById(R.id.mainLayout);

// Define StartApp Mrec
Mrec startAppMrec = new Mrec(this);
RelativeLayout.LayoutParams mrecParameters =
            new RelativeLayout.LayoutParams(
                        RelativeLayout.LayoutParams.WRAP_CONTENT,
                        RelativeLayout.LayoutParams.WRAP_CONTENT);
mrecParameters.addRule(RelativeLayout.CENTER_HORIZONTAL);
mrecParameters.addRule(RelativeLayout.ALIGN_PARENT_BOTTOM);

// Add to main Layout
mainLayout.addView(startAppMrec, mrecParameters);

Cover Ads

Cover is a 1200X628 px. (300x157 DP) rectangular ad integrated within an app's layout. The ad will be refreshed automatically.

Add the following View inside your Activity layout XML:

<com.startapp.sdk.ads.banner.Cover
android:id="@+id/startAppCover"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerHorizontal="true" />
NOTE:

This code places a View inside your Activity. You also have the option to add additional attributes for placing it in the desired location in your Activity.

For adding Cover programmatically, instead of using the layout XML:

// Get the Main relative layout of the entire activity
RelativeLayout mainLayout = (RelativeLayout)findViewById(R.id.mainLayout);

// Define StartApp Cover
Cover startAppCover = new Cover(this);
RelativeLayout.LayoutParams coverParameters =
            new RelativeLayout.LayoutParams(
                        RelativeLayout.LayoutParams.WRAP_CONTENT,
                        RelativeLayout.LayoutParams.WRAP_CONTENT);
coverParameters.addRule(RelativeLayout.CENTER_HORIZONTAL);
coverParameters.addRule(RelativeLayout.ALIGN_PARENT_BOTTOM);

// Add to main Layout
mainLayout.addView(startAppCover, coverParameters);

Rewarded Video Ads

Rewarded Ads are interstitial video ads that provide a reward to the user in exchange for watching an entire video ad. The reward might be in-app goods, virtual currency or any premium content provided by the application. Because users actually opt-in to watch a rewarded video and are granted with something valuable in return, Rewarded Ads are an effective and clean monetization solution for stronger user retention and keeping users engaged in your application for a longer amount of time.

In order to show a Rewarded Ad, pass the following AdMode parameter when calling the loadAd() method:

startAppAd.loadAd(AdMode.REWARDED_VIDEO);

Implement the following listener in order to get a callback when the user completes watching the video and is eligible for getting the reward:

startAppAd.setVideoListener(new VideoListener() {
     @Override
     public void onVideoCompleted() {
          // Grant user with the reward
     }
});

Native Ads

A "Native Ad" is a raw representation of an ad without any pre-defined wrapping UI, which gives you the freedom to design and control the ad exactly as you want. Using Native Ads, you can design an ad experience that perfectly fits your application's scene, content and functionality.

For a full integration guide, please refer to the "Using Native Ads" section under the "Advanced Usage" page.

App-ads.txt

What is app-ads.txt?

With a goal of increasing transparency to the mobile advertising echo system, IAB Tech Lab released app-ads.txt.

App-ads.txt allows the publishers to declare who is officially authorized to sell their inventory, this in return, allows the buyers to purchase the same inventory with confidence in terms of it's legitimacy and authenticity. 

Adding App-ads.txt with Start.io

At Start.io (Formerly StartApp) we strive to comply with the highest industry standards, we strongly encourage you to add Start.io entries to your app-ads.txt file.
In order to do so, you need to simply follow the instructions on this article. 

Advanced Usage

For advanced usage, please refer to the "Advanced Usage"

 

Was this article helpful?
Have more questions? submit a request