Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
package com.google.android.gms.example.jetpackcomposedemo.formats

import androidx.compose.material3.Text
import androidx.compose.runtime.Composable
import com.google.android.gms.ads.nativead.NativeAd
import com.google.android.gms.compose_util.NativeAdView

// [START compose_native_ad]
@Composable
fun DisplayNativeAdView(nativeAd: NativeAd) {
// `NativeAdView` is a custom composable that wraps the SDK's `NativeAdView`.
NativeAdView {
// Access assets from the ad object
nativeAd.headline?.let { Text(text = it) }
nativeAd.body?.let { Text(text = it) }
}
}
// [END compose_native_ad]
Loading