• Tutorials
  • Tips & Tricks
  • Applications
  • News

Android Trainee

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

How to implement Metaps Ads In Android Application?

Written by admin@androidtrainee
Tutorials Advertising Networks, android, android ads, android Advertising Networks, Metaps Leave a Comment

About Metaps :-

Metaps provides monetization support for app developers by analyzing market trends at our 8 offices located around the world.

  • Tokyo, Japan (HQ)
  • Shanghai, China
  • Seoul, S. Korea
  • Singapore
  • San Francisco, U.S.A
  • Hong Kong
  • Taipei, Taiwan
  • London, UK

PlatForm :-

  • Android
  • Unity 3D
  • Adobe AIR

Payment Method:-

  • Wire Transfer.

Payment Terms :- Metaps may provide Developer with a monthly statement following the end of each calendar month which includes the amount, in United States Dollars (unless otherwise stated), payable to Developer. Any payment to Developer shall be due and payable within sixty (60) days after the end of that month . Payments to the Developer shall be based upon Metaps’ records which shall be final. If Developer disputes any payment, it must notify Metaps in writing within fifteen (15) business days from the date of receipt of the monthly statement; otherwise the Developer shall be deemed to waive its rights to raise the dispute.

 

—> Frist Open Metaps Account And  app ID.

After Getting All Information  Start Eclipse And Create New Project.

For google_play_services 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>
<uses-permission android:name="android.permission.READ_PHONE_STATE"></uses-permission>
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"></uses-permission>
<uses-permission android:name="android.permission.ACCESS_WIFI_STATE"></uses-permission>

<meta-data android:name="com.google.android.gms.version" android:value="@integer/google_play_services_version" />

<activity android:name="net.metaps.sdk.WallActivity" android:theme="@android:style/Theme.Light" android:screenOrientation="portrait"></activity>
<activity android:name="net.metaps.sdk.StatusActivity" android:theme="@android:style/Theme.Light" android:screenOrientation="portrait"></activity>

 

–> For Banner Ads Open Layout.xml File.


<RelativeLayout 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:background="@android:color/black" >

<TextView
android:id="@+id/pointsTitle"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentTop="true"
android:layout_centerHorizontal="true"
android:layout_marginTop="84dp"
android:text="@string/points"
android:textColor="@android:color/white"
tools:context=".MainActivity" />

<TextView
android:id="@+id/pointsCount"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@+id/pointsTitle"
android:layout_centerHorizontal="true"
android:text="Large Text"
android:textAppearance="?android:attr/textAppearanceLarge"
android:textColor="@android:color/white" />

<Button
android:id="@+id/goWall"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@+id/pointsCount"
android:layout_centerHorizontal="true"
android:layout_marginTop="60dp"
android:onClick="goMetapsOfferWall"
android:text="@string/metapsOfferWallExplanation" />

<Button
android:id="@+id/doConfirm"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@+id/goWall"
android:layout_centerHorizontal="true"
android:layout_marginTop="20dp"
android:onClick="runInstallReport"
android:text="@string/metapsLabelOptionConfirm" />

</RelativeLayout>

open MyActivity.java file…


import net.metaps.sdk.Const;
import net.metaps.sdk.Factory;
import net.metaps.sdk.Offer;
import net.metaps.sdk.Receiver;
import android.app.Activity;
import android.content.SharedPreferences;
import android.os.Bundle;
import android.util.Log;
import android.view.View;
import android.widget.TextView;
import android.widget.Toast;

/**
* This sample activity's goal is to show how to easily integrate Metaps SDK in your own application
* @author Metaps
*
*/
public class SampleActivity extends Activity implements Receiver {
public static final String PREFS_NAME = "MetapsSampleApp2";
public static final String POINTS_PARAM = "testPointsAmount";

//These parameters are only TEST parameters. Use your application's parameter from your Metaps account when integration SDK in your application
private final static String APPLICATION_ID = "CLTAA000010010";
private final static int SDK_MODE = Const.SDK_MODE_TEST;

/** end user's id in your app */
private String endUserId = null;
/** scenario : free string for the reward */
private String scenario = null;
/** points to stock the received points */
private int points = 0;

@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);

this.endUserId = "USER0000";
this.scenario  = "REWARD01";

setContentView(R.layout.activity_sample);

SharedPreferences pref = this.getSharedPreferences(PREFS_NAME, Activity.MODE_PRIVATE);
points = pref.getInt(POINTS_PARAM, 0);

try{
//Call as soon as possible initialize() method
Factory.initialize(this, this, APPLICATION_ID, SDK_MODE);
} catch(Exception e){
e.printStackTrace();
Toast.makeText(this, e.getMessage(), Toast.LENGTH_LONG).show();
}
}
@Override
protected void onResume() {
super.onResume();
//You can run install check process when resuming an activity to get the newest data
runInstallReport(null);
showPointsCount();
}

/**
* listener method to launch Metaps offer wall.
* @param v View
*/
public void goMetapsOfferWall(View v){
try {
Factory.launchOfferWall(this, endUserId, scenario);
} catch (Exception e){
e.printStackTrace();
Toast.makeText(this, e.getMessage(), Toast.LENGTH_LONG).show();
}
}

/**
* Run install check process manually<br>
* (there is a background process running but you may wish to get the newest data)
* @param v
*/
public void runInstallReport(View v){
try {
Factory.runInstallReport();
} catch (Exception e){
e.printStackTrace();
Toast.makeText(this, e.getMessage(), Toast.LENGTH_LONG).show();
}
}

@Override
public boolean finalizeOnError(Offer offer) {
StringBuffer buf = new StringBuffer();
String appName = offer.getAppName()==null ? "" : offer.getAppName().trim();
String appId = offer.getAppId()==null ? "" : offer.getAppId().trim();
String campaignId = offer.getCampaignId()==null ? "" : offer.getCampaignId().trim();
String status = String.valueOf(offer.getStatus());
String lastCode = offer.getErrorCode()==null ? "" : offer.getErrorCode().trim();
buf.append(appId).append("\n")
.append(campaignId).append("\n")
.append(appName).append("\n")
.append(status).append("\n")
.append(lastCode);
Log.e("SampleActivity", buf.toString());
return true;
}

@Override
public boolean retrieve(int currencyAmount, Offer offer) {
updatePointsCount(currencyAmount);
showPointsCount();
return true;
}

private void showPointsCount() {
runOnUiThread(new Runnable() {
public void run() {
TextView textView = (TextView)findViewById(R.id.pointsCount);
textView.setText("" + points);
}
});
}

private void updatePointsCount(int addedPoints) {
this.points += addedPoints;
SharedPreferences settings = getSharedPreferences(PREFS_NAME, 0);
SharedPreferences.Editor editor = settings.edit();
editor.putInt(POINTS_PARAM, this.points);
editor.commit();
}
}

 

—> Run Your Code.

metaps-offer-wall

admin@androidtrainee

 Previous Article How to implement adfalcon Ads In Android Application?
Next Article   How to implement AppNext 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:
  • 463890Total visitors:
  • 110Visitors today:
  • 2483Visitors per month:
  • 1Visitors currently online:
© Copyright 2014. Theme by BloomPixel.
Posting....