diff --git a/app/build.gradle b/app/build.gradle index f18e887..fd2051b 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -64,6 +64,7 @@ android { resValue 'string', 'admob_live_now_all_list_banner_unit_id', 'ca-app-pub-1299501215847962/7226255534' resValue 'string', 'admob_creator_channel_banner_unit_id', 'ca-app-pub-1299501215847962/4594592451' resValue 'string', 'admob_message_banner_unit_id', 'ca-app-pub-1299501215847962/1161494343' + resValue 'string', 'admob_live_room_banner_unit_id', 'ca-app-pub-1299501215847962/4552330040' } debug { @@ -87,6 +88,7 @@ android { resValue 'string', 'admob_live_now_all_list_banner_unit_id', 'ca-app-pub-3940256099942544/6300978111' resValue 'string', 'admob_creator_channel_banner_unit_id', 'ca-app-pub-3940256099942544/6300978111' resValue 'string', 'admob_message_banner_unit_id', 'ca-app-pub-3940256099942544/6300978111' + resValue 'string', 'admob_live_room_banner_unit_id', 'ca-app-pub-3940256099942544/6300978111' } } compileOptions { diff --git a/app/src/main/java/kr/co/vividnext/sodalive/live/room/LiveRoomActivity.kt b/app/src/main/java/kr/co/vividnext/sodalive/live/room/LiveRoomActivity.kt index 2cdc32e..f423412 100644 --- a/app/src/main/java/kr/co/vividnext/sodalive/live/room/LiveRoomActivity.kt +++ b/app/src/main/java/kr/co/vividnext/sodalive/live/room/LiveRoomActivity.kt @@ -32,6 +32,7 @@ import androidx.recyclerview.widget.RecyclerView import coil.load import coil.transform.CircleCropTransformation import com.github.dhaval2404.imagepicker.ImagePicker +import com.google.android.gms.ads.AdRequest import com.google.gson.Gson import com.orhanobut.logger.Logger import io.agora.rtc2.ClientRoleOptions @@ -175,6 +176,7 @@ class LiveRoomActivity : BaseActivity(ActivityLiveRoomB override fun setupView() { bindData() + setupAdMob() loadingDialog = LoadingDialog(this, layoutInflater) imm = getSystemService( @@ -391,6 +393,16 @@ class LiveRoomActivity : BaseActivity(ActivityLiveRoomB setupSpeakerListAdapter() } + override fun onResume() { + super.onResume() + binding.adView.resume() + } + + override fun onPause() { + binding.adView.pause() + super.onPause() + } + override fun onDestroy() { hideKeyboard { viewModel.quitRoom(roomId) { @@ -398,9 +410,14 @@ class LiveRoomActivity : BaseActivity(ActivityLiveRoomB agora.deInitAgoraEngine() } } + binding.adView.destroy() super.onDestroy() } + private fun setupAdMob() { + binding.adView.loadAd(AdRequest.Builder().build()) + } + private fun showOptionMenu( context: Context, userId: Long, diff --git a/app/src/main/res/layout/activity_live_room.xml b/app/src/main/res/layout/activity_live_room.xml index cb5e5fe..1a99e56 100644 --- a/app/src/main/res/layout/activity_live_room.xml +++ b/app/src/main/res/layout/activity_live_room.xml @@ -1,5 +1,6 @@ @@ -510,4 +511,14 @@ android:contentDescription="@null" android:src="@drawable/btn_message_send" /> + +