-
Notifications
You must be signed in to change notification settings - Fork 3
Home
ddt8086 edited this page Sep 25, 2019
·
3 revisions
[TOC]
buildscript {
repositories {
google()
jcenter()
maven { url "https://jitpack.io" }
maven { url "https://dl.bintray.com/sunjiangrong/maven" }
}
dependencies {
classpath 'com.android.tools.build:gradle:3.4.2'
}
}
allprojects {
repositories {
google()
jcenter()
maven { url "https://jitpack.io" }
maven { url "https://dl.bintray.com/sunjiangrong/maven" }
}
}
dependencies {
implementation ('com.tuia:sdk:1.0.0.0'){
transitive = true
}
}
//(sdk内部已经处理相关权限问题,如果遇到冲突咨询对应开发即可)
<uses-permission android:name="android.permission.INTERNET"/>
<!-- 推啊appkey-->
<meta-data
android:name="TUIA_APPKEY"
android:value="kEzAJT4iRMMag29Z7yWcJGfcVgG" />
<!-- 推啊appSecret -->
<meta-data
android:name="TUIA_APPSECRET"
android:value="3Wq4afvvdPhyHBR29LgRwEC16gkrrFXZ5BRoL2E" />
本SDK可运行于Android4.1 (API Level 15) 及以上版本。
<uses-sdk android:minSdkVersion="15" android:targetSdkVersion="28" />
-ignorewarnings
-dontwarn com.lechuan.midunovel.view.**
-keep class com.lechuan.midunovel.view.** { *; }
在自定义的Application 的onCreate方法中,调用以下方法:(详细内容请参考demo中的代码示例)
FoxSDK.init(this);
(开屏广告嵌入代码说明(详见demo代码))
第一步:xml中引入布局文件
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:background="@drawable/default_image_background">
<com.lechuan.midunovel.view.FoxShView
android:id="@+id/TMSh_container"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:countTime="2" />
</RelativeLayout>
第二步:代码引入示例
public class SplashActivity extends Activity {
protected FoxShView mOXShView;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_splash);
//获取开屏广告对象
mOXShView = (FoxShView)findViewById(R.id.TMSh_container);
//设置跳转目标
mOXShView.setTargetClass(this,MainActivity.class);
//设置广告监听
mOXShView.setAdListener(new FoxShListener(){
@Override
public void onTimeOut() {
Log.d("TMShActivity", "onTimeOut");
}
@Override
public void onReceiveAd() {
Log.d("TMShActivity", "onReceiveAd");
}
@Override
public void onFailedToReceiveAd() {
Log.d("TMShActivity", "onFailedToReceiveAd");
}
@Override
public void onLoadFailed() {
Log.d("TMShActivity", "onLoadFailed");
}
@Override
public void onCloseClick() {
Log.d("TMShActivity", "onCloseClick");
}
@Override
public void onAdClick() {
Log.d("TMShActivity", "onClick");
}
@Override
public void onAdExposure() {
Log.d("TMShActivity", "onAdExposure");
}
@Override
public void onAdReward(String data) {
Log.d("========", "onAdReward");
}
});
//加载广告,传入对应的(必传)广告位id和(必传)用户id
mOXShView.loadAd(466,"userId");
}
@Override
protected void onDestroy() {
//销毁控件
if (mOXShView != null) {
mOXShView.destroy();
}
super.onDestroy();
}
(横幅广告嵌入代码说明(详见demo代码))
第一步:xml中引入布局文件
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/apk/res-auto"
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="match_parent">
<com.lechuan.midunovel.view.FoxStreamerView
android:id="@+id/TMBrView"
android:layout_width="match_parent"
android:layout_height="wrap_content"
tools:fox_size="lander_foxBr"/>
<View
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@color/background"/>
</LinearLayout>
第二步:代码引入示例
public class SbannerActivity extends BaseActivity {
private FoxStreamerView mTMBrAdView;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_sbanner);
mTMBrAdView = (FoxStreamerView) findViewById(R.id.TMBrView);
//设置监听
mTMBrAdView.setAdListener(new FoxListener() {
@Override
public void onReceiveAd() {
Log.d("========", "onReceiveAd");
}
@Override
public void onFailedToReceiveAd() {
Log.d("========", "onFailedToReceiveAd");
}
@Override
public void onLoadFailed() {
Log.d("========", "onLoadFailed");
}
@Override
public void onCloseClick() {
Log.d("========", "onCloseClick");
}
@Override
public void onAdClick() {
Log.d("========", "onClick");
}
@Override
public void onAdExposure() {
Log.d("========", "onAdExposure");
}
@Override
public void onAdReward(String data) {
Log.d("========", "onAdReward");
}
});
//加载广告,传入对应的(必传)广告位id和(必传)用户id
mTMBrAdView.loadAd(308403,userId);
}
@Override
protected void onDestroy() {
//销毁控件
if (mTMBrAdView != null) {
mTMBrAdView.destroy();
}
super.onDestroy();
}
}
(浮标广告嵌入代码说明(详见demo代码))
第一步:xml中引入布局文件
<?xml version="1.0" encoding="utf-8"?>
<FrameLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="match_parent">
<com.lechuan.midunovel.view.FoxWallView
android:id="@+id/TMAw1"
android:layout_width="60dp"
android:layout_height="60dp"
android:layout_gravity="center_vertical|right"
tools:wall_shape="square"/>
</FrameLayout>
第二步:代码引入示例
public class DobberActivity extends BaseActivity {
private ListView mListView;
private FoxWallView mOxWallView;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_dobber);
mOxWallView = (FoxWallView) findViewById(R.id.TMAw1);
//设置广告监听
mOxWallView.setAdListener(new FoxListener() {
@Override
public void onReceiveAd() {
Log.d("========", "onReceiveAd");
}
@Override
public void onFailedToReceiveAd() {
Log.d("========", "onFailedToReceiveAd");
}
@Override
public void onLoadFailed() {
Log.d("========", "onLoadFailed");
}
@Override
public void onCloseClick() {
Log.d("========", "onCloseClick");
}
@Override
public void onAdClick() {
Log.d("========", "onAdClick");
}
@Override
public void onAdExposure() {
Log.d("========", "onAdExposure");
}
@Override
public void onAdReward(String data) {
Log.d("========", "onAdReward");
}
});
//加载广告,传入对应的(必传)广告位id和(必传)用户id
mOxWallView.loadAd(301971,userId);
}
@Override
protected void onDestroy() {
//销毁控件
if (mOxWallView != null) {
mOxWallView.destroy();
}
super.onDestroy();
}
}
(插屏广告嵌入代码说明(详见demo代码))
第一步:代码直接引入示例
public class InterstitialActivity extends BaseActivity {
private FoxTbScreen mTMItAd;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_interstitial);
//创建广告对象
mTMItAd = new FoxTbScreen(this);
//设置广告监听
mTMItAd.setAdListener(new FoxListener() {
@Override
public void onReceiveAd() {
Log.d("========", "onReceiveAd");
}
@Override
public void onFailedToReceiveAd() {
Log.d("========", "onFailedToReceiveAd");
}
@Override
public void onLoadFailed() {
Log.d("========", "onLoadFailed");
}
@Override
public void onCloseClick() {
Log.d("========", "onCloseClick");
}
@Override
public void onAdClick() {
Log.d("========", "onAdClick");
}
@Override
public void onAdExposure() {
Log.d("========", "onAdExposure");
}
@Override
public void onAdReward(String data) {
Log.d("========", "onAdReward");
}
});
//加载广告,传入对应的(必传)广告位id和(必传)用户id
mTMItAd.loadAd(301968,userId);
}
@Override
protected void onDestroy() {
//销毁控件
if (mTMItAd != null) {
mTMItAd.destroy();
}
super.onDestroy();
}
}
(应用墙广告嵌入代码说明(详见demo代码))
第一步:xml中引入布局文件
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:gravity="center_vertical"
android:orientation="horizontal">
<com.lechuan.midunovel.view.FoxWallView
android:id="@+id/app1"
android:layout_width="80dp"
android:layout_height="80dp"
android:scaleType="centerCrop"
tools:wall_shape="circular"/>
</LinearLayout>
第二步:代码引入示例
public class AppWallActivity extends BaseActivity {
private FoxWallView mOxWallView1;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_app_wall);
mOxWallView1 = (FoxWallView) findViewById(R.id.app1);
//设置广告监听
mOxWallView1.setAdListener(new FoxListener() {
@Override
public void onReceiveAd() {
Log.d("========", "onReceiveAd");
}
@Override
public void onFailedToReceiveAd() {
Log.d("========", "onFailedToReceiveAd");
}
@Override
public void onLoadFailed() {
Log.d("========", "onLoadFailed");
}
@Override
public void onCloseClick() {
Log.d("========", "onCloseClick");
}
@Override
public void onAdClick() {
Log.d("========", "onAdClick");
}
@Override
public void onAdExposure() {
Log.d("========", "onAdExposure");
}
@Override
public void onAdReward(String data) {
Log.d("========", "onAdReward");
}
});
//加载广告,传入对应的(必传)广告位id和(必传)用户id
mOxWallView2.loadAd(301972,userId);
}
@Override
protected void onDestroy() {
//销毁控件
if (mOxWallView1 != null) {
mOxWallView1.destroy();
}
super.onDestroy();
}
}
(Banner广告嵌入代码说明(详见demo代码))
第一步:xml中引入布局文件
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
<com.lechuan.midunovel.view.FoxStreamerView
android:id="@+id/TMBrView"
android:layout_width="match_parent"
android:layout_height="wrap_content"
tools:fox_size="foxBr" />
</LinearLayout>
第二步:代码引入示例
public class BannerActivity extends BaseActivity {
private FoxStreamerView mTMBrAdView;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_banner);
mTMBrAdView = (FoxStreamerView) findViewById(R.id.TMBrView);
////设置广告监听
mTMBrAdView.setAdListener(new FoxListener() {
@Override
public void onReceiveAd() {
Log.d("========", "onReceiveAd");
}
@Override
public void onFailedToReceiveAd() {
Log.d("========", "onFailedToReceiveAd");
}
@Override
public void onLoadFailed() {
Log.d("========", "onLoadFailed");
}
@Override
public void onCloseClick() {
Log.d("========", "onCloseClick");
}
@Override
public void onAdClick() {
Log.d("========", "onAdClick");
}
@Override
public void onAdExposure() {
Log.d("========", "onExposure");
}
@Override
public void onAdReward(String data) {
Log.d("========", "onAdReward");
}
});
//加载广告,传入对应的(必传)广告位id和(必传)用户id
mTMBrAdView.loadAd(301970,userId);
}
@Override
protected void onDestroy() {
//销毁控件
if (mTMBrAdView != null) {
mTMBrAdView.destroy();
}
super.onDestroy();
}
}
(自定义广告嵌入代码说明(详见demo代码))
第一步:代码直接引入示例
public class NonStandarActivity extends BaseActivity {
private FoxCustomerTm mOxCustomerTm;
private TextView textView;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_non_standar);
textView = (TextView)findViewById(R.id.content_text);
//创建广告对象
mOxCustomerTm = new FoxCustomerTm(this);
//加载广告,传入对应的(必传)广告位id和(必传)用户id
mOxCustomerTm.loadAd(304507,userId);
mOxCustomerTm.setAdListener(new FoxNsTmListener() {
@Override
public void onReceiveAd(String result) {
//获取广告返回结果
Log.d("========", "onReceiveAd:"+result);
textView.setText(result);
}
@Override
public void onFailedToReceiveAd() {
Log.d("========", "onFailedToReceiveAd");
}
@Override
public void onAdReward(String data) {
}
});
}
@Override
protected void onDestroy() {
//销毁控件
if (mOxCustomerTm != null) {
mOxCustomerTm.destroy();
}
super.onDestroy();
}
}
第二步:广告曝光的时候必须调用
mOxCustomerTm.adExposed();
第三步:广告点击的时候必须调
mOxCustomerTm.adClicked();
{
"finishType" : 1,
"orderId" : "168408070629",
"userId" : "123",
"timestamp" : "1566791113031",
"prizeFlag" : "XXX",
"appKey" : "4W8ReCvDm4fy3Fpn52MgPgUWmdfS",
"sign" : "5093659d6bf802d1a407df81d6aab9f9",
"score" : null,
"reason" : "-1",
"url" : null
}
名称 | 类型 | 备注 |
---|---|---|
userId | String | 用户 id,用户在媒体的唯一识别信息,来源于活动链接中的&userId=xxx,由媒体拼接提供 |
timestamp | Number | 时间戳 |
prizeFlag | String | 常量,请求上报的奖励在对接方媒体系统内的奖励标识,用于标识具体的奖励类型,由媒体提供 |
orderId | String | 推啊订单号,具有唯一性,幂等由媒体保障 |
appKey | String | 媒体公钥 |
sign | String | 签名 |
score | Number | 如果是数值类型的奖励,则同时请求充值对应的数值 score,比如积分、金币、倍数 |