245일차 - 커뮤니티 앱개발 (13) : 광고 배너
2021. 8. 31. 23:25ㆍDiary/201~300
1. Google AdMob 등록
2. manifests
<meta-data
android:name="com.google.android.gms.ads.APPLICATION_ID"
android:value="ID" />
3. Adv 초기화
var adv_view : AdView
MobileAds.initialize(
this
) { }
adv_view = findViewById(R.id.login_adv)
val adv_request = AdRequest.Builder().build()
adv_view.loadAd(adv_request)
4. Layout
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="center"
android:orientation="vertical"
android:background="@android:color/transparent"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent">
<com.google.android.gms.ads.AdView
android:id="@+id/login_adv"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
app:adSize="BANNER"
app:adUnitId="ID">
</com.google.android.gms.ads.AdView>
</LinearLayout>
'Diary > 201~300' 카테고리의 다른 글
247일차 - 구글플레이스토어 앱 배포 (2) (0) | 2021.09.02 |
---|---|
246일차 - 구글플레이스토어 앱 배포 (0) | 2021.09.01 |
남은기능 정리 (0) | 2021.08.31 |
244일차 - 커뮤니티 앱개발 (12) : 푸시 알림 (0) | 2021.08.30 |
243일차 - 커뮤니티 앱개발 (11) : 게시글 & 댓글 수정, 삭제 (0) | 2021.08.29 |