• Tutorials
  • Tips & Tricks
  • Applications
  • News

Android Trainee

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

How to implement Tapjoy Ads In Android Application?

Written by admin@androidtrainee
Tutorials Leave a Comment

About :-OPTIMIZE YOUR APP USERS’ LTV WITH A SINGLE INTELLIGENT PLATFORM.

Platform :-

  • Android
  • iOS

Payment Method & Terms :-

  • Paypal
  • Wire Transfer

Tapjoy pays out on Net 30 terms once you hit a minimum of $250 – Publishers are paid monthly for the previous month’s earning. For example, earnings earned in January 2014, are paid out at the end of February 2014. If you have any questions regarding earning payouts, please contact your Tapjoy representative or email support@tapjoy.com.

 

—> Frist Open Tapjoy Account And Get APP_ID And SECRET_KEY.

 

After Getting All Information  Start Eclipse And Create New Project.

For google play services lib import project from the J:\android-sdk-windows\extras\google\google_play_services\libproject

—>  AndroidManifest.xml


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

 

</activity>
<activity
android:name="com.tapjoy.TJCOffersWebView"
android:configChanges="orientation|keyboardHidden|screenSize" />
<activity
android:name="com.tapjoy.TapjoyFullScreenAdWebView"
android:configChanges="orientation|keyboardHidden|screenSize" />
<activity
android:name="com.tapjoy.TapjoyVideoView"
android:configChanges="orientation|keyboardHidden|screenSize" />
<activity
android:name="com.tapjoy.TJAdUnitView"
android:configChanges="orientation|keyboardHidden|screenSize"
android:theme="@android:style/Theme.Translucent.NoTitleBar.Fullscreen"
android:hardwareAccelerated="true" />
<activity
android:name="com.tapjoy.mraid.view.ActionHandler"
android:configChanges="orientation|keyboardHidden|screenSize" />
<activity
android:name="com.tapjoy.mraid.view.Browser"
android:configChanges="orientation|keyboardHidden|screenSize" />

 

 

–> For Banner Ads Open Layout.xml File.


<ScrollView
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:fillViewport="true">
<LinearLayout
android:id="@+id/LinearLayout01"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:orientation="vertical"
android:padding="15dp"
>

<View
android:layout_height="5dp"
android:layout_width="fill_parent" />

<Button
android:layout_height="wrap_content"
android:layout_width="fill_parent"
android:text="Offerwall"
android:id="@+id/OffersButton"
android:visibility="visible"
android:layout_margin="5dp"/>

<Button
android:id="@+id/GetDirectPlayVideoAd"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_margin="5dp"
android:text="Get Direct Play Video Ad"
android:visibility="visible" />

<View
android:layout_height="5dp"
android:layout_width="fill_parent"/>

</LinearLayout>
</ScrollView>

 

open MyActivity.java file…


import java.util.Hashtable;

import android.app.Activity;
import android.os.Bundle;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.Button;

import com.tapjoy.TJError;
import com.tapjoy.TJEvent;
import com.tapjoy.TJEventCallback;
import com.tapjoy.TJEventRequest;
import com.tapjoy.TapjoyConnect;
import com.tapjoy.TapjoyConnectFlag;
import com.tapjoy.TapjoyConnectNotifier;

public class MainActivity extends Activity implements View.OnClickListener{
private Button offers;

private Button getDirectPlayVideoAd;

@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);

Hashtable<String,Object> connectFlags = new Hashtable<String,Object>();
connectFlags.put(TapjoyConnectFlag.ENABLE_LOGGING, "true");
//If you are not using Tapjoy Managed currency, you would set your own user ID here.
//connectFlags.put(TapjoyConnectFlag.TJC_OPTION_USER_ID, "A_UNIQUE_USER_ID");
TapjoyConnect.requestTapjoyConnect(getApplicationContext(),
"bba49f11-b87f-4c0f-9632-21aa810dd6f1",
"yiQIURFEeKm0zbOggubu",
connectFlags,
new TapjoyConnectNotifier() {
@Override public void connectSuccess() {
//The Connect call succeeded
//  Log.i(TAG, "The Connect call succeeded ");
}
@Override public void connectFail() {
//The connect call failed
//  Log.i(TAG, "The connect call failed");
}
});

offers = (Button) findViewById(R.id.OffersButton);

getDirectPlayVideoAd = (Button) findViewById(R.id.GetDirectPlayVideoAd);
getDirectPlayVideoAd.setOnClickListener(this);

offers.setOnClickListener(new OnClickListener() {

@Override
public void onClick(View v) {
// TODO Auto-generated method stub
TapjoyConnect.getTapjoyConnectInstance().showOffers();
}
});

}
public void onClick(View v) {
if (v instanceof Button) {
Button button = ((Button) v);
int id = button.getId();
if (id == R.id.GetDirectPlayVideoAd) {
// Disable button

// Shows a direct play video
TJEvent directPlayEvent = new TJEvent(this, "video_unit", new TJEventCallback()
{
@Override
public void sendEventCompleted(TJEvent event, boolean contentAvailable) {

if (contentAvailable) {
// If enableAutoPresent is set to false for the event, we need to present the event's content ourselves
event.showContent();
}
}

@Override
public void sendEventFail(TJEvent event, TJError error) {

}

@Override
public void contentDidShow(TJEvent event) {

}

@Override
public void contentDidDisappear(TJEvent event) {

}

@Override
public void didRequestAction(TJEvent event, TJEventRequest request) {
// Does nothing
}

@Override
public void contentIsReady(TJEvent event, int statusPreloadIncomplete) {

}
});

// By default, ad content will be shown automatically on a successful send. For finer control of when content should be shown, call:
directPlayEvent.enableAutoPresent(false);

directPlayEvent.send();
}
}
}
}

 

—> Run Your Code.

t2 t1

 

admin@androidtrainee

 Previous Article How to implement mopub Ads In Android Application?
Next Article   How to implement adcolony 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

  • 150Reads yesterday:
  • 463952Total visitors:
  • 57Visitors today:
  • 2545Visitors per month:
  • 3Visitors currently online:
© Copyright 2014. Theme by BloomPixel.
Posting....