Skip to content

Commit c38e73a

Browse files
Fix native ad loading
The `NativeAdLoader` was incorrectly using the banner ad unit ID. This commit corrects it to use the `native_ad_banner_unit_id` string resource, ensuring the correct ad type is loaded.
1 parent 70ed048 commit c38e73a

File tree

3 files changed

+29
-58
lines changed

3 files changed

+29
-58
lines changed

.idea/workspace.xml

Lines changed: 26 additions & 57 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

app/src/main/java/com/d4rk/androidtutorials/java/ads/managers/NativeAdLoader.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323
public class NativeAdLoader {
2424

2525
public static void load(@NonNull Context context, @NonNull ViewGroup container) {
26-
AdLoader adLoader = new AdLoader.Builder(context, context.getString(R.string.ad_banner_unit_id))
26+
AdLoader adLoader = new AdLoader.Builder(context, context.getString(R.string.native_ad_banner_unit_id))
2727
.forNativeAd(nativeAd -> {
2828
LayoutInflater inflater = LayoutInflater.from(context);
2929
NativeAdView adView = (NativeAdView) inflater.inflate(R.layout.native_ad, container, false);

app/src/main/res/values/untranslatable_strings.xml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,4 +56,6 @@
5656
<string name="error_loading_changelog" translatable="false">Error loading changelog</string>
5757

5858
<string name="ad_banner_unit_id" translatable="false">ca-app-pub-5294151573817700/3821250346</string>
59+
<string name="native_ad_banner_unit_id" translatable="false">ca-app-pub-5294151573817700/7875350818</string>
60+
5961
</resources>

0 commit comments

Comments
 (0)