Skip to content

Commit 8ed2e07

Browse files
Nicholas Ventimigliacopybara-github
authored andcommitted
Updated code snippets for compose.
PiperOrigin-RevId: 916037848
1 parent 9828b48 commit 8ed2e07

1 file changed

Lines changed: 18 additions & 0 deletions

File tree

  • kotlin/advanced/JetpackComposeDemo/app/src/main/java/com/google/android/gms/example/jetpackcomposedemo/formats
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
package com.google.android.gms.example.jetpackcomposedemo.formats
2+
3+
import androidx.compose.material3.Text
4+
import androidx.compose.runtime.Composable
5+
import com.google.android.gms.ads.nativead.NativeAd
6+
import com.google.android.gms.compose_util.NativeAdView
7+
8+
// [START compose_native_ad]
9+
@Composable
10+
fun DisplayNativeAdView(nativeAd: NativeAd) {
11+
// `NativeAdView` is a custom composable that wraps the SDK's `NativeAdView`.
12+
NativeAdView {
13+
// Access assets from the ad object
14+
nativeAd.headline?.let { Text(text = it) }
15+
nativeAd.body?.let { Text(text = it) }
16+
}
17+
}
18+
// [END compose_native_ad]

0 commit comments

Comments
 (0)