CASH BUTTON SDK - KOTLIN (v1.4.0)
안내사항
CASH BUTTON 기본 연동 가이드 확인 후 본 문서를 통해 연동 부탁 드립니다.
참조 모듈 설정
annotationProcessor
구성 (kotlin-kapt)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
//build.gralde
apply plugin: 'kotlin-kapt'
android {
...
...
}
dependencies {
// implementation files('libs/캐시버튼_SDK_파일명.aar')
implementation files('libs/avatye_cashbutton_v1.4.0.aar')
implementation 'org.jetbrains.kotlin:kotlin-stdlib-jdk7:1.3.72'
implementation 'androidx.core:core-ktx:1.3.2'
implementation 'androidx.appcompat:appcompat:1.2.0'
implementation 'androidx.dynamicanimation:dynamicanimation:1.0.0'
implementation 'com.google.android.material:material:1.3.0-alpha03'
implementation 'com.google.android.gms:play-services-basement:17.4.0'
implementation 'com.google.android.gms:play-services-ads-identifier:17.0.0'
implementation 'joda-time:joda-time:2.10.5'
implementation 'com.google.zxing:core:3.4.0'
implementation('com.github.bumptech.glide:glide:4.11.0')
kapt 'com.github.bumptech.glide:compiler:4.11.0'
/** Buzzvill sdk */
implementation("com.buzzvil:buzzad-benefit:2.17.1")
/** mobon sdk */
implementation('com.mobon.sdk:com.mobon.sdk:1.0.4.18') {
transitive = true
exclude group: 'com.google.android.gms'
}
/** service-channeltalk */
implementation ('com.zoyi.channel:plugin-android:7.2.0'){
exclude group: "androidx.gridlayout", module: 'gridlayout'
}
/** igaworks ssp sdk & mediation */
implementation 'com.igaworks.ssp:IgawAdPopcornSSP:2.4.2'
/** ad-mediation-group (unityads,vungle,facebook) */
implementation 'com.unity3d.ads:unity-ads:3.4.8'
implementation 'com.vungle:publisher-sdk-android:6.7.1'
implementation 'com.facebook.android:audience-network-sdk:6.2.0'
implementation "com.kakao.adfit:ads-base:3.4.0"
/** androidx.appcompat:appcompat:x.x.x 을 사용하고 있지 않을 경우 추가 필요 */
implementation 'androidx.localbroadcastmanager:localbroadcastmanager:1.0.0'
}
참조 모듈 정보
| Kotlin 언어 모듈 |
| |
| google play service |
| |
| Joda-Time providers a quality replacement for the java date and time classes. |
| |
| |
| 캐시 버튼 실시간 문의 대응 모듈 |
| AD NETWORK |
| |
| |
| |
| |
|
위 패키지를 사용하지 않을 경우만 추가 합니다. |
|
|
메소드 호출
캐시버튼 동작을 위해서는 Application, MainActivity(메인 액티비티 / Launcher, Main) 설정이 필요합니다.
메소드 정보
캐시버튼 SDK 초기화
|
|
Application Class를 사용하고 있지 않았다면, 캐시버튼 SDK 연동을 위해 AndroidManifest.xml에 해당 Application Class를 생성하고 등록해야 합니다. |
|
|
CashButtonConfig.initialize() 함수에 들어가는 데이터 클래스 |
| |
캐시버튼 SDK 시작
|
|
|
onCreate() → setContentView(…) 후에 위치해야 하며, 해당 함수 마지막에 위치 바랍니다. |
캐시버튼 Dock 상태
|
|
|
|
|
| ||
캐시버튼 Visibility
|
|
| CashButton → Visible.Gone |
| CashButton → Visible.View |
Application
Application Class 초기화 되지 않을 경우 앱 실행에 문제가 발생합니다.
Android 5.0(API 수준 21) 미만의 경우 Multidex 적용이 필요합니다.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
// App.kt
class App : Application() {
...
override fun onCreate() {
super.onCreate()
...
/** cash-button-notify-model */
val notifyModel = CashNotifyModel(
context = this,
allowNotify = true,
name = "AppName",
appIconResourceId = 0,
statusIconResourceId = 0
)
/** cash-button-config initializer */
CashButtonConfig.initializer(
application = this,
notifyModel = notifyModel
)
}
...
}
// AndroidManifest.xml
<manifest ... >
<application
android:name=".App"
...
...
</manifest>
MainActivity
메인으로 사용되는 액티비티에 설정 합니다.
onCreate() → setContentView(…) 후에 위치해야 합니다.
setContentView(…) 를 통한 Layout 설정 완료 후 설정되어야 합니다.
callback::onSuccess() → callback 이벤트를 통한 앱 로직을 추가 하지 마세요.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
// MainActivity.kt
// imports
import com.avatye.sdk.cashbutton.ICashButtonBackPressedListener
import com.avatye.sdk.cashbutton.ICashButtonCallback
import com.avatye.sdk.cashbutton.ui.CashButtonLayout
...
private var cashButtonLayout: CashButtonLayout? = null
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
...
setContentView(...)
...
/** initialize cashbutton view */
CashButtonLayout.init(this@MainActivity, object : ICashButtonCallback {
override fun onSuccess(view: CashButtonLayout?) {
cashButtonLayout = view
}
})
}
...
...
// option
override fun onBackPressed() {
cashButtonLayout?.onBackPressed(object : ICashButtonBackPressedListener {
override fun onBackPressed(isSuccess: Boolean) {
if (isSuccess) {
finish()
}
}
})
}
...
onBackPressed - (optional)
해당 설정을 했을 경우 Listener:onBackPressed 값
false : 팝업 광고가 노출되어 있는 상태 또는 캐시버튼 독이 노출되어 있는 경우
(독이 노출되어 있는경우 감춰진 상태로 전환)
true : 팝업 광고가 노출되지 않고, 캐시버튼 독이 감춰진 상태
추가기능
문의하기
캐시버튼과 관련된 문의를 받기 위한 메뉴 노출 가이드 입니다.
친구초대
친구초대 메세지의 타이틀을 변경합니다.