Tuesday, November 5, 2013

Make money $$$ for android dev with startapp

It's easy and simple! Now let's begin!

First, register a new account here: Register Start App


Choose I'm a developer





Choose Get Started Now


And now enter your information then click Create Account


Click Add App


Enter package name of your app. Click Get Info.


If your app is on Google Play, choose Yes, if not, choose No and enter some information



and click Continue


Choose kind of ads for generating SDK and click Continue


Now download SDK, and note Developer ID and App ID

After unzip the sdk file downloaded, we have some files


copy 3 jar files into somewhere you want

Now, in android project in eclipse IDE, right click choose Properties - Java Build Path


click Add External Jars and choose the path to 3 jar files

choose Order and Export and check 3 jar files just added


Step 2: Update your manifest file
Under the main manifest tag, add the following permissions:

<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.READ_PHONE_STATE"/>
//These permissions are only required for showing the ad when pressing the Home button:
<uses-permission android:name="android.permission.SYSTEM_ALERT_WINDOW"/>
<uses-permission android:name="android.permission.GET_TASKS"/>


Under the application tag, add a new activity:
Note: Make sure that this activity appears only once, even if it is required for an additional StartApp
SDK.

<activity android:name="com.startapp.android.eula.EULAActivity"
   android:theme="@android:style/Theme.Translucent"
   android:configChanges="keyboard|keyboardHidden|orientation" />


Under the application tag, add new activities:
Note: replace <package_name> with your package as declared in your manifest in both activities.

<activity android:name="com.startapp.android.publish.list3d.List3DActivity"
   android:taskAffinity="<package_name>.AppWall"
   android:theme="@android:style/Theme" />

<activity android:name="com.startapp.android.publish.AppWallActivity"
   android:theme="@android:style/Theme.Translucent"
   android:taskAffinity="<package_name>.AppWall"      
   android:configChanges="orientation|keyboardHidden" />

Then, choose a layout (xml file) in res folder you want to add banner and add this code snipet
 3D banner:
<com.startapp.android.publish.banner.banner3d.Banner3Dandroid:id="@+id/startApp3DBanner" android:layout_width="wrap_content"android:layout_height="wrap_content"/>

Normal banner:
<com.startapp.android.publish.banner.bannerstandard.BannerStandard
android:id="@+id/startAppStandardBanner"android:layout_width="wrap_content" android:layout_height="wrap_content"/>

Now you can run and see the result

[ttaiit.blogspot.com]


Reference more... in StartApp In-App V2 0 SearchBox V1 0.pdf in zip sdk file of start app:
.
.
.
Step 3: Initialize the SDK
In the OnCreate method of your activity, call the static functions:
StartAppAd.init(this, "<Your Developer Id>", "<Your App ID>");
StartAppSearch.init(this, "<Your Developer Id>", "<Your App ID>");
right before calling setContentView()

Note: The parameters of StartAppAd.init and StartAppSearch.init are:
1.  Activity – your Activity
2.  Developer ID – String
3.  App ID – String


You can find your IDs in the developers’ portal: http://developers.startapp.com
After logging in, your developer ID will be at the top right-hand corner of the page:


To find your application ID, click on
 and then choose the relevant ID from your app list:



Step 4: Show Banners
There are 3 different types of banners:

Automatic Banner (recommended): An automatic selection of banners between the two listed below
Standard Banner:   A Standard Banner
3D Banner:   A three dimensional rotating banner

Adding the Automatic Banner
To add the Automatic Banner, add the following view inside your Activity layout XML:
<com.startapp.android.publish.banner.Banner
android:id="@+id/startAppBanner"
android:layout_width="wrap_content"
android:layout_height="wrap_content"/>

Note: This code will place a View inside your Activity and you can add additional attributes for placing it
in the desired location within the Activity.
If you do not wish to add the Automatic Banner, choose one of the following options:
1.  Adding a Standard Banner
Add the following View inside your Activity layout .XML
    <com.startapp.android.publish.banner.bannerstandard.BannerStandard
    android:id="@+id/startAppStandardBanner"
    android:layout_width="wrap_content"
android:layout_height="wrap_content"/>

Note: This code will place a View inside your Activity and you can add additional attributes for
placing it in the desired location within the Activity.

2.  Adding a 3D Banner
Add the following View inside your Activity layout .XML:
<com.startapp.android.publish.banner.banner3d.Banner3D
    android:id="@+id/startApp3DBanner"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"/>
Note: This code will place a View inside your Activity and you can add additional attributes for placing it in the
desired location within the Activity.
Step 5: Show Interstitial Ads
Initializing the StartApp Ad Object

1.  In your activity, create a member variable:

private StartAppAd startAppAd = new StartAppAd(this);

Note: The parameter of startAppAd constructor is the context (activity).
2.  Override the onResume method and add the call to startAppAd.onResume():

@Override
public void onResume(){
      super.onResume();
      startAppAd.onResume();
  }

Note: Add this call right after the call to super.onResume()

Showing Interstitials:

1.  Show the Ad in chosen places within the app
You can choose to show the interstitial ad in several locations within your application.
This could be upon entering, 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 steps 2 and 3 below.

Add the following code to the appropriate place or places within your activities in which you
would like to show the ad:

startAppAd.showAd(); // show the ad
startAppAd.loadAd(); // load the next ad

Note: Don't forget to call loadAd() right after showAd() – this will load your next ad.

Example for showing an interstitial ad between activities:

  public void btnOpenActivity (View view){
      startAppAd.showAd();
    startAppAd.loadAd();
      Intent nextActivity = new Intent(this, NextActivity.class);
      startActivity(nextActivity);
}
2.  Show the Ad upon exit by pressing the 'back' button
Override the onBackPressed() method and add a call to the startAppAd.onBackPressed():

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

Note: Place the startAppAd.onBackPressed()call BEFORE the super.onBackPressed()call.
3.  Show the Ad upon exit by pressing 'home' button
The Home button functionality can improve results and revenue.
Override the onPause() method and add a call the startAppAd.onPause():

  @Override
  public void onPause() {
      super.onPause();
      startAppAd.onPause();
  }

Notes:
a.  There are two extra permissions required to run this as described in “Step 2: Update your
manifest file” above.
b.  To display the ad in more activities, simply repeat these steps in each desired activity.

Step 6: Integrate the Search Box (optional)
In the OnCreate method of your activity, call the static function:
StartAppSearch.showSearchBox(this);
right after calling setContentView()

If you would like the Search Box to appear in additional activities, repeat this step in each one
of the activities you would like it to show in. The search box cannot be implemented in activities
with a Dialog Theme (android:theme="@android:style/Theme.Dialog).
Note: for better user experience, and in order to avoid reload of the search box when rotating
the phone, it is recommended to go back to your manifest file and add the following attribute
to any activity that you added the Search Box to:
android:configChanges="orientation|screenSize"

Step 7: Obfuscation (optional)
StartApp SDK is already obfuscated. If you choose to obfuscate your App by using proguard, you need to
use the following configuration in the proguard configuration file:


-optimizations !code/simplification/arithmetic,!field/*,!class/merging/*
-keep class com.searchboxsdk.** {
  *;
}
-keep class com.startapp.android.eula.** {
  *;
}
-keep class com.startapp.** {
      *;
}

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


0 comments:

Post a Comment

Choose an Android item