• Tutorials
  • Tips & Tricks
  • Applications
  • News

Android Trainee

  • Tutorials
  • Tips & Tricks
  • Applications
  • News
Home  /  Tutorials  /  How to implement adcolony Ads In Android Application?
18 February 2015

How to implement adcolony Ads In Android Application?

Written by admin@androidtrainee
Tutorials Leave a Comment

About :-Some of our partners. News. Catch the latest AdColony news and press releases, and see which industry events we’ll be attending near you soon.

Platform :-

  • Android
  • iOS
  • Adobe Air
  • Unity

Payment Method & Terms :-

  • via check
  • PayPal
  • wire transfer, or ACH payments

Our payment terms are net 60 days.  Payment can be received via check, PayPal, wire transfer, or ACH payments for domestic partners.  For international partners, we offer check, PayPal, or wire transfer.  Please confirm payment with your publishing representative and ensure your mailing information is correct in the AdColony client dashboard in your Account page.  A service charge is deducted for ACH, PayPal and wire transfers. For domestic publishers, a W9 must be completed (on clients.adcolony.com).  International publishers do not need to provide a tax form.

 

—> Frist Open adcolony Account And Get APP ID And ZONE 1.

After Getting All Information  Start Eclipse And Create New Project.

 

—>  AndroidManifest.xml

 


<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="android.permission.READ_PHONE_STATE" />

 

<activity android:name="com.jirbo.adcolony.AdColonyOverlay"
android:configChanges="keyboardHidden|orientation|screenSize"
android:theme="@android:style/Theme.Translucent.NoTitleBar.Fullscreen" />
<activity android:name="com.jirbo.adcolony.AdColonyFullscreen"
android:configChanges="keyboardHidden|orientation|screenSize"
android:theme="@android:style/Theme.Black.NoTitleBar.Fullscreen" />
<activity android:name="com.jirbo.adcolony.AdColonyBrowser"
android:configChanges="keyboardHidden|orientation|screenSize"
android:theme="@android:style/Theme.Black.NoTitleBar.Fullscreen" />

 

–> For Banner Ads Open Layout.xml File.


 

<?xml version="1.0" encoding="utf-8"?>
<FrameLayout  xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
>
<LinearLayout
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
>
<ImageView
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:src="@drawable/adc"
android:gravity="center_horizontal"
/>
<TextView
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:text=" "
/>
<Button android:id ="@+id/zone1"
android:text="Loading..."
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="@drawable/button"
android:gravity="center_vertical|center_horizontal|center"
android:layout_gravity="center_vertical|center_horizontal|center"
android:textColor="#ffffff"
android:textSize="30sp"
/>
<Button android:id ="@+id/zone2"
android:text="Loading..."
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="@drawable/button"
android:gravity="center_vertical|center_horizontal|center"
android:layout_gravity="center_vertical|center_horizontal|center"
android:textColor="#ffffff"
android:textSize="30sp"
/>
<Button android:id ="@+id/zone3"
android:text="Loading..."
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="@drawable/button"
android:gravity="center_vertical|center_horizontal|center"
android:layout_gravity="center_vertical|center_horizontal|center"
android:textColor="#ffffff"
android:textSize="30sp"
/>
<TextView
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:text=" "
/>
<TextView
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:text="You can play videos from different zones as desired."
android:gravity="center_horizontal"
/>
</LinearLayout>
</FrameLayout>

 

 

open MultiZoneDemo.java file…


import java.util.ArrayList;

import android.app.*;
import android.content.pm.ActivityInfo;
import android.os.*;
import android.util.Log;
import android.view.*;
import android.view.View.*;
import android.widget.*;

import com.jirbo.adcolony.*;

public class MultiZoneDemo extends Activity
implements AdColonyAdListener, AdColonyAdAvailabilityListener
{
final static public String APP_ID = "app185a7e71e1714831a49ec7";
final static public String ZONE_1  = "vz06e8c32a037749699e7050";
final static public String ZONE_2  = "vz2d167a733dfe48fa99000d";
final static public String ZONE_3  = "vze0c3973f70dc4bcfb15663";

Handler button_text_handler;
Runnable button_text_runnable;
ArrayList<String> zones_to_update;
Button video_button_1;
Button video_button_2;
Button video_button_3;

/** Called when the activity is first created. */
@Override
public void onCreate( Bundle savedInstanceState )
{
super.onCreate(savedInstanceState);

AdColony.configure( this,
"version:1.0,store:google",
//   version - arbitrary application version
//   store   - google or amazon
APP_ID,
ZONE_1, ZONE_2, ZONE_3
);

AdColony.addAdAvailabilityListener(this);

if ( !AdColony.isTablet() ) setRequestedOrientation( ActivityInfo.SCREEN_ORIENTATION_PORTRAIT );

setContentView( R.layout.main );

video_button_1 = (Button) findViewById( R.id.zone1 );
video_button_2 = (Button) findViewById (R.id.zone2 );
video_button_3 = (Button) findViewById( R.id.zone3 );

video_button_1.setOnClickListener(
new OnClickListener()
{
public void onClick( View v )
{
AdColonyVideoAd ad = new AdColonyVideoAd( ZONE_1 ).withListener( MultiZoneDemo.this );
ad.show();
}
});

video_button_2.setOnClickListener(
new OnClickListener()
{
public void onClick( View v )
{
AdColonyVideoAd ad = new AdColonyVideoAd( ZONE_2 ).withListener( MultiZoneDemo.this );
ad.show();
}
});

video_button_3.setOnClickListener(
new OnClickListener()
{
public void onClick( View v )
{
AdColonyVideoAd ad = new AdColonyVideoAd( ZONE_3 ).withListener( MultiZoneDemo.this );
ad.show();
}
});

// Handler and Runnable for updating button text based on ad availability listener
button_text_handler = new Handler();
button_text_runnable = new Runnable()
{
public void run()
{
if ( zones_to_update.contains(ZONE_1) ) video_button_1.setText("Video Zone 1");
if ( zones_to_update.contains(ZONE_2) ) video_button_2.setText("Video Zone 2");
if ( zones_to_update.contains(ZONE_3) ) video_button_3.setText("Video Zone 3");
}
};

zones_to_update = new ArrayList<String>();

}

public void onPause()
{
super.onPause();
AdColony.pause();
}

public void onResume()
{
super.onResume();
AdColony.resume( this );
}

//Ad Started Callback - called only when an ad successfully starts playing
public void onAdColonyAdStarted( AdColonyAd ad )
{
Log.d("AdColony", "onAdColonyAdStarted");
}

//Ad Attempt Finished Callback - called at the end of any ad attempt - successful or not.
public void onAdColonyAdAttemptFinished( AdColonyAd ad )
{
// You can ping the AdColonyAd object here for more information:
// ad.shown() - returns true if the ad was successfully shown.
// ad.notShown() - returns true if the ad was not shown at all (i.e. if onAdColonyAdStarted was never triggered)
// ad.skipped() - returns true if the ad was skipped due to an interval play setting
// ad.canceled() - returns true if the ad was cancelled (either programmatically or by the user)
// ad.noFill() - returns true if the ad was not shown due to no ad fill.

Log.d("AdColony", "onAdColonyAdAttemptFinished");
}

//Ad Availability Change Callback - update button text
public void onAdColonyAdAvailabilityChange(boolean available, String zone_id)
{
if (available)
{
zones_to_update.add(zone_id);
button_text_handler.post(button_text_runnable);
}
}

}

 

—> Run Your Code.

 

ad1

admin@androidtrainee

 Previous Article How to implement Tapjoy Ads In Android Application?
Next Article   How to implement AppLovin Ads In Android Application?

Related Posts

  • Android New Quick Action Animation.

    July 15, 2015
  • Android satellite menu Animation.

    July 15, 2015
  • Android Staggered Grid & List View.

    July 14, 2015

Leave a Reply

Cancel reply

Tags

admob Advertising Networks AerServ Airpush android android ads android Advertising Networks Android App android chart animation Android GridView android L android lollipop androidmapv2 AppBrain AppFlood Appia AppKey Appnext AppOptim Appwiz chart chartview Epom Market google place api GridView Image Loader InMobi LeadBolt location map mapv2 mapv2 api material design Minimob Mobicow MobileCore MobiMicro NativeX Pingjam RevMob StarApplication startapp TapContext touched location Widdit

Count per Day

  • 347Reads yesterday:
  • 463871Total visitors:
  • 91Visitors today:
  • 2464Visitors per month:
  • 0Visitors currently online:
© Copyright 2014. Theme by BloomPixel.
Posting....