remon android sdk guide

Download REMON Android SDK GUIDE

If you can't read please download the document

Upload: hoangtram

Post on 30-Jan-2017

240 views

Category:

Documents


2 download

TRANSCRIPT

1 / 25

REMON Android SDK GUIDE (SDK Version 1.4.1)

2 / 25

2014.06.30 1.0.0

2014.09.30 1.1.0 ,

2014.12.01 1.2.0 Proguard

2014.12.16 1.2.0 Android Studio

2015.01.29 1.3.0

2015.02.06 1.3.1 Permission

2015.11.11 1.4.0 Listener

2015.12.09 1.4.1

3 / 25

1. REMON SDK ----------------------------------------------------------------- 5

2. --------------------------------------------------------------------------- 5

3. REMON ----------------------------------------------------------- 6

3.1 RemoN SDK -------------------------------------------------------------------------------- 6

3.1.1 cId --------------------------------------------------------------------------------- 6

3.1.2 Import --------------------------------------------------------------------------- 6

3.1.2.1 ADT ------------------------------------------------------------------- 6

3.1.2.2 Android Studio ------------------------------------------------------ 8

3.1.3 AndroidManifest.xml ------------------------------------------------------------------ 11

3.1.4 UI -------------------------------------------------------- 12

3.1.5 ProGuard () ------------------------------------------------------------------------ 20

4. CLASS REFERENCE ---------------------------------------------------------------- 20

4.1 Package kr.co.dnasoft.remonsdk ----------------------------------------------------------------- 20

4.1.1 Class Summary -------------------------------------------------------------------------------- 20

4.1.2 Interface Summary ---------------------------------------------------------------------------- 20

4.1.3 Enum Summary ------------------------------------------------------------------------------- 20

4.2 Class AdView --------------------------------------------------------------------------------------- 20

4.2.1 Constructor Summary --------------------------------------------------------------------------- 20

4.2.2 Method Summary ----------------------------------------------------------------------------- 21

4.3 Class AdInfo ---------------------------------------------------------------------------------------- 22

4.3.1 Constructor Summary ------------------------------------------------------------------------- 22

4.4 Class AdInterstitial --------------------------------------------------------------------------------- 23

4.4.1 Constructor Summary ------------------------------------------------------------------------- 23

4.4.2 Method Summary ----------------------------------------------------------------------------- 23

4.5 Class AdListener ----------------------------------------------------------------------------------- 24

4.5.1 Interface AdListener.OnAdClickedListener ---------------------------------------------------- 24

4.5.2 Interface AdListener.OnAdFailedListener ----------------------------------------------------- 24

4.5.3 Interface AdListener.OnAdClosedListener ---------------------------------------------------- 24

4 / 25

4.5.4 Interface AdListener.OnAdLoadedListener --------------------------------------------------- 24

4.5.5 Interface AdListener.OnAdWillLoadListener -------------------------------------------------- 25

5. ENUM ADERRORCODE ----------------------------------------------------------- 25

5 / 25

1. RemoN SDK

Android Application

.

.

-

Inline 320 * 50 9 (2.3)

Square 150 * 150 9 (2.3)

Rectangle 300 * 250 9 (2.3)

Floating() 104 * 77 -> 300 * 250 11 (3.0)

Interstitial 320 * 480 9 (2.3)

2.

Version 1.4.1

-

Version 1.4.0

-

- Listener

- SDK Log

- WebView

- Animation

Version 1.3.1

- Permission

Version 1.3.0

-

Version 1.2.0

- Google Ad Id google-play-services

-

Version 1.1.0

-

-

-

Version 1.0.0

-

6 / 25

3. RemoN

3.1 RemoN SDK

- RemoNSDK.jar : RemoN

- RemonTest : Eclipse

- RemonTest_Android_Studio : Android Studio

3.1.1 cId

- http://www.realclick.co.kr/product/?sidx=rm

cId .

3.1.2 Import

3.1.2.1 ADT

- RemoN SDK Import .

http://www.realclick.co.kr/product/?sidx=rm

7 / 25

- Google play service ( )

( : {SDK Root}/extras/google/google_play_services/libproject/google-play-services_lib)

SDK Manager Extras/Google Play Services .

8 / 25

3.1.2.2 Android Studio

- SDK libs .

- Open Module Settings ..

9 / 25

- , Dependencies . +

File Dependency .

- RemoN_SDK_x.x.x.jar OK .

10 / 25

- SDK OK .

- build.gradle .

11 / 25

3.1.3 AndroidManifest.xml

- ,

.

- . (

.)

- Activity Activity

android:configChanges="orientation" .

(Project Build Target API Level 13 screenSize )

- Google Ad ID meta-data .

Google Ad Id

meta-data

12 / 25

3.1.4 UI

- View Activity AdView

View clientId . ( Parameter

)

Inline Banner

public class JavaTypeInlineBanner extends Activity {

private final static String TAG = JavaTypeInlineBanner.class.getName();

private static AdView adView = null; private LinearLayout laytout = null;

@Override protected void onCreate(Bundle savedInstanceState) {

super.onCreate(savedInstanceState); setContentView(R.layout.java_type_banner); initRemon();

}

private void initRemon() {

laytout = (LinearLayout) findViewById(R.id.ad_layout);

//RemoN View

if(adView != null) { adView.stopAd(); adView.setAdListener(null); laytout.removeView(adView);

adView = null; }

//RemoN

Project Build Target API Level

13 screenSize

13 / 25

adView = new AdView(this.getApplicationContext()); /*==========================================

* Listener( .)

===========================================*/ AdListener listener = new AdListener();

// Listener

listener.OnAdClickedListener = new OnAdClickedListener() { @Override public void OnClickedAd() {

Log.i(TAG, "JAVA Type Inline Banner Click ad"); } };

// Listener

listener.OnAdFailedListener = new OnAdFailedListener() { @Override public void OnAdFiled (AdErrorCode arg0, String arg1) { Log.w(TAG, "JAVA Type Inline Banner Ad failed : " + arg1); }

};

// Load Listener

listener.OnAdLoadedListener = new OnAdLoadedListener() { @Override public void OnAdLoaded() { Log.i(TAG, "JAVA Type Inline Banner Ad loaded"); } };

// Listener

listener.OnAdWillLoadListener = new OnAdWillLoadListener() {

@Override public void OnAdWillLoad () { Log.i(TAG, "JAVA Type Inline Banner Ad will load"); } };

// Listener

listener.OnAdClosedListener = new OnAdClosedListener() { @Override public void OnAdClosed () {

Log.i(TAG, "JAVA Type Inline Banner Ad closed"); } };

// cId ()

adView.setcId("MTQxMDg3NDQ1MzY3OTc4");

//

//( )

adView.setBackgroundColor("#FFEAEAEA");

// (default : 30, max : 300)

adView.setRefreshInterval(30);

//SDK State Log ( Log )

14 / 25

adView.setSDKLog(TAG + " State");

// : INVISIBLE, GONE (default : VISIBLE)

adView.setVisibility(View.VISIBLE); laytout.addView(adView);

//

adView.setTerms(true);

//

AdInfo adInfo = new AdInfo();

//

adInfo.setGender("f");

//

adInfo.setAge(38); adView.setAdInfo(adInfo);

//

adView.setAdListener(listener);

// Animation (Default : FADE)

adView.setAnimationType(AnimationType.SLIDE_LTOR);

//

adView.requestAd();

}

@Override protected void onPause() {

if(adView != null) { adView.onPause();

} super.onPause();

}

@Override protected void onResume() {

if(adView != null) {

adView.onResume(); } super.onResume();

}

@Override protected void onDestroy() {

if(adView != null) { adView.stopAd(); adView.setAdListener(null); laytout.removeView(adView); adView = null;

} super.onDestroy();

} }

15 / 25

Activity .

public class JavaTypeInterstitialBanner extends Activity {

//

AdInterstitial interstitial = null;

@Override protected void onCreate(Bundle savedInstanceState) {

super.onCreate(savedInstanceState);

initRemon(); }

private void initRemon() {

// Listener

AdListener listener = new AdListener();

// Listener

listener.OnAdClickedListener = new OnAdClickedListener() { @Override public void OnClickedAd() { Log.i("JavaTypeInterstitialBanner", "JAVA Type Interstitial Banner Click ad");

} };

// Listener

listener.OnAdFailedListener = new OnAdFailedListener() { @Override public void OnAdFiled (AdErrorCode arg0, String arg1) { Log.i("JavaTypeInterstitialBanner", " JAVA Type Interstitial Banner Failed ");

Log.i("JavaTypeInterstitialBanner", "Error Code : " + arg0 + ", Reason : " + arg1); }

};

// Load Listener

listener.OnAdLoadedListener = new OnAdLoadedListener() { @Override public void OnAdLoaded() { Log.i("JavaTypeInterstitialBanner", " JAVA Type Interstitial Banner Loaded "); }

};

// Listener

listener.OnAdWillLoadListener = new OnAdWillLoadListener() {

@Override

.

16 / 25

public void OnAdWillLoad () { Log.i("JavaTypeInterstitialBanner", " JAVA Type Interstitial Banner Will Load"); }

};

// Listener

listener.OnAdClosedListener = new OnAdClosedListener() {

@Override public void OnAdClosed () { Log.i("JavaTypeInterstitialBanner", " JAVA Type Interstitial Banner Closed "); }

};

// ( Activity AdListener )

interstitial = new AdInterstitial(this, listener);

// client Id (Mandatory)

interstitial.setcId("MTQyODkzNTMxNTcyNjE4");

// (Optional, Default : false)

interstitial.setTestMode(true);

// (Optional, Default : false)

interstitial.setLogMode(true);

// ( )

interstitial.setUserBGColor("#cef279");

// (Optional, Default : false)

interstitial.setUseAutoClose(true);

// (Optional, Default : 10, : 0 10 )

interstitial.setAutoCloseTime(30);

// (Optional, Default : false)

interstitial.setTerms(true);

// (Optional)

AdInfo adInfo = new AdInfo();

// (Optional, m : , f : )

adInfo.setGender("f");

// (Optional)

adInfo.setAge(38); interstitial.setAdInfo(adInfo);

//

interstitial.requestAd(); }

@Override protected void onPause() {

super.onPause(); }

@Override

protected void onResume() { super.onResume();

}

@Override protected void onDestroy() {

//

17 / 25

if(interstitial != null) { interstitial.removeAd(); interstitial = null; }

super.onDestroy(); }

}

.

Activity

public class AgreeSampleActivity extends Activity {

private final static String TAG = AgreeSampleActivity.class.getName();

private static AdView adView = null; private LinearLayout laytout = null;

/** */

private boolean agreeFlag = false;

@Override

protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.java_type_banner); laytout = (LinearLayout) findViewById(R.id.ad_layout); initRemon();

Agreement(); }

private void initRemon() {

//RemoN View

if(adView != null) {

adView.stopAd(); adView.setAdListener(null);

laytout.removeView(adView); adView = null; }

//Remon

adView = new AdView(this); });

//

.

18 / 25

/*==========================================

* Listener( .)

===========================================*/ AdListener listener = new AdListener();

// Listener

listener.OnAdClickedListener = new OnAdClickedListener() { @Override public void OnClickedAd() { Log.i(TAG, " AgreeSampleActivity Inline Banner Click ad");

} };

// Listener

listener.OnAdFailedListener = new OnAdFailedListener() { @Override public void OnAdFiled (AdErrorCode arg0, String arg1) { Log.w(TAG, " AgreeSampleActivity Inline Banner Ad failed : " + arg1); } };

// Load Listener

listener.OnAdLoadedListener = new OnAdLoadedListener() {

@Override public void OnAdLoaded() { Log.i(TAG, " AgreeSampleActivity Inline Banner Ad loaded"); } };

// Listener

listener.OnAdWillLoadListener = new OnAdWillLoadListener() { @Override

public void OnAdWillLoad () { Log.i(TAG, "AgreeSampleActivity Inline Banner Ad will load"); } };

// Listener

listener.OnAdClosedListener = new OnAdClosedListener() { @Override public void OnAdClosed () { Log.i(TAG, " AgreeSampleActivity Inline Banner Ad closed");

} };

// client Id ()

adView.setcId("MTQxMDg3NDQ1MzY3OTc4");

// ( )

adView.setBackgroundColor("#FFEAEAEA");

// (default : 30, max : 300)

adView.setRefreshInterval(30);

//SDK State Log ( Log )

adView.setSDKLog(TAG + " State");

// : INVISIBLE, GONE (default : VISIBLE)

19 / 25

adView.setVisibility(View.VISIBLE); laytout.addView(adView);

//

AdInfo adInfo = new AdInfo(); adInfo.setGender("f"); adInfo.setAge(38);

adView.setAdInfo(adInfo);

//

adView.setAdListener(listener);

}

private void Agreement() {

Intent intent = new Intent(AgreeSampleActivity.this, AgreeActivity.class); startActivityForResult(intent, 1);

intent = null; }

@Override protected void onActivityResult(int requestCode, int resultCode, Intent data) {

super.onActivityResult(requestCode, resultCode, data);

if(requestCode== 1 || resultCode==RESULT_OK){ if(data.getStringExtra("AgreeFlag").equals("Y")){//use data if(adView != null) { agreeFlag = true; }

} else { if(adView != null) { agreeFlag = false; }

//

adView.setTerms(agreeFlag); }

}

//

adView.requestAd();

}

@Override protected void onPause() {

if(adView != null) { adView.onPause();

} super.onPause();

}

@Override protected void onResume() {

if(adView != null) {

adView.onResume(); } super.onResume();

}

20 / 25

@Override protected void onDestroy() {

if(adView != null) {

adView.stopAd(); adView.setAdListener(null); laytout.removeView(adView); adView = null; } laytout = null;

super.onDestroy(); }

}

3.1.5 ProGuard ()

Proguard .

-dontwarn android.support.**,com.google.android.gms.**

-dontwarn kr.co.dnasoft.remonsdk.**

-keep class kr.co.dnasoft.remonsdk.** {*;}

4. Class reference

4.1 Package kr.co.dnasoft.remonsdk

4.1.1 Class Summary

AdView View Object .

4.1.2 Interface Summary

AdListener.OnAdClickedListener Listener

AdListener.OnAdFailedListener Listener

AdListener.OnAdClosedListener Listener

AdListener.OnAdLoadedListener Load Listener

AdListener.OnAdWillLoadListener Listener

4.1.3 Enum Summary

ADState

ADErrorCode Error Type .

4.2 Class AdView

4.2.1 Constructor Summary

AdView(Context context)

Java

21 / 25

AdView(Context context, AttributeSet attrs)

XML

AdView(Context context, AttributeSet attrs, int defStyle)

XML

4.2.2 Method Summary

void onPause()

void onResume()

.

void requestAd()

void stopAd()

.

void setBackgroundColor(String userBGColor)

Server

.

String getBackGroundColor()

.

String setcId(String clientId)

cId .

String getcId()

cId .

void setRefreshInterval(int refreshInterval)

.

Int getRefreshInterval()

.

void setVisibility(int visibility)

View .

int getVisibility()

View .

void setSDKLog(String tag)

SDK Log .

void setTerms(Boolean isTerms)

.

boolean isTerms()

.

void setAdInfo(AdInfo adInfo)

22 / 25

.

AdInfo getAdInfo()

.

void setAnimationType(AnimationType animationType)

View Animation .

AdListener setAdListener(AdListener adListener)

View Listener .

void getAdListener()

Listener .

void AdListener.OnAdClickedListener

Listener

void AdListener.OnAdFailedListener

Listener

void AdListener.OnAdClosedListener

Listener

void AdListener.OnAdLoadedListener

Load Listener

void AdListener.OnAdWillLoadListener

Listener

4.3 Class AdInfo

4.3.1 Constructor Summary

AdInfo()

4.3.2 Method Summary

void setGender(String gender)

.

, gender

.

,

.

- : M

- : F

String getGender()

.

Void setAge(int age)

.

23 / 25

age

.

, .

int getAge()

.

4.4 Class AdInterstitial

4.4.1 Constructor Summary

AdInterstitial(Activity activity, AdListener listener)

4.4.2 Method Summary

void onPause()

void onResume()

.

void requestAd()

void stopAd()

.

void setBackgroundColor(String userBGColor)

Server

.

String getBackGroundColor()

.

String setcId(String clientId)

cId .

String getcId()

cId .

void setUseAutoClose((boolean useAutoClose)

. (Default : false)

boolean getUseAutoClose()

.

void seAutoCloseTime(int autoCloseTime)

. (Default : 3, : 0 10 )

boolean getAutoCloseTime()

.

24 / 25

void setSDKLog(String tag)

SDK Log .

void setTerms(Boolean isTerms)

. (Default : false)

boolean isTerms()

.

void AdListener.OnAdClickedListener

Listener

void AdListener.OnAdFailedListener

Listener

void AdListener.OnAdClosedListener

Listener

Void AdListener.OnAdLoadedListener

Load Listener

Void AdListener.OnAdWillLoadListener

Listener

4.5 Class AdListener

4.5.1 Interface AdListener.OnAdClickedListener

- Method Summary

Void OnClickedAd()

.

4.5.2 Interface AdListener.OnAdFailedListener

- Method Summary

Void OnAdFailed(ADErrorCode error, String message)

.

4.5.3 Interface AdListener.OnAdClosedListener

- Method Summary

Void OnAdClosed()

.

4.5.4 Interface AdListener.OnAdLoadedListener

- Method Summary

Void OnAdLoaded()

Load .

25 / 25

4.5.5 Interface AdListener.OnAdWillLoadListener

- Method Summary

void OnAdWillLoad()

.

5. Enum ADErrorCode

, AdListener.OnAdFailedListener.OnAdFailed() .

, AdListener.OnAdFailedListener AdListener

OnAdFailedListener () .

.

NO_AD

PERMISSION_DENIED_ERROR .

AndroidManifest.xml

.

INVALID_AD_LAYOUT

INVALID_AD_LAYOUT_SMAILL

INVALID_CLIENT_ID cId

INVALID_CLIENT_ID_OR_PACKAGENAME Client ID

INVALID_PACKAGENAME

INVALID_AD_TYPE

INVALID_AD_URL Url

INVALID_CLINET_ID_OR_

UNSERVICEABLE_SDK_VERSION

Client ID SDK

Version

NETWORK_ERROR

CONNECTION_ERROR

LOAD_AD_ERROR

SHOW_AD_ERROR

ACTIVITIES_IS_NOT_VAILD Activitity

INVALID_ANDROID_VERSION

INVALID_CONTEXT Context

1. RemoN SDK 2. 3. RemoN 3.1 RemoN SDK 3.1.1 cId 3.1.2 Import3.1.2.1 ADT 3.1.2.2 Android Studio

3.1.3 AndroidManifest.xml 3.1.4 UI 3.1.5 ProGuard ()

4. Class reference4.1 Package kr.co.dnasoft.remonsdk4.1.1 Class Summary4.1.2 Interface Summary4.1.3 Enum Summary

4.2 Class AdView4.2.1 Constructor Summary4.2.2 Method Summary

4.3 Class AdInfo4.3.1 Constructor Summary

4.4 Class AdInterstitial4.4.1 Constructor Summary4.4.2 Method Summary

4.5 Class AdListener4.5.1 Interface AdListener.OnAdClickedListener4.5.2 Interface AdListener.OnAdFailedListener4.5.3 Interface AdListener.OnAdClosedListener4.5.4 Interface AdListener.OnAdLoadedListener4.5.5 Interface AdListener.OnAdWillLoadListener

5. Enum ADErrorCode