### Initialize SDK and Load Native Ad Source: https://docs.adpies.com/android/integration/native Initializes the AdPie SDK with the application context and Media ID, then creates a `NativeAd` object using the Slot ID and the `NativeAdViewBinder`. Finally, it requests the ad by calling `loadAd()`. ```java private NativeAd nativeAd; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); // SDK 초기화로 앱실행 1회만 호출한다. (Main Activity 에 필수로 입력한다.) AdPieSDK.getInstance().initialize(getApplicationContext(), "AdPie-Media-ID"); ... NativeAdViewBinder viewBinder = new NativeAdViewBinder.Builder(R.layout.adpie_native_ad) // Layout ID .setIconImageId(R.id.native_ad_icon) // Icon ID .setTitleId(R.id.native_ad_title) // Title ID .setDescriptionId(R.id.native_ad_description) // Description ID .setMainId(R.id.native_ad_main) // Main ID .setCallToActionId(R.id.native_ad_cta) // Call-To-Action ID .setOptOutId(R.id.native_optout) // Opt-out I .build(); // 광고 연동을 위한 슬롯 ID를 필수로 입력한다. nativeAd = new NativeAd(this, "AdPie-Slot-ID", viewBinder); // 광고 호출 nativeAd.loadAd(); } ``` -------------------------------- ### Add Glide Dependency for Image Handling Source: https://docs.adpies.com/android/integration/native Integrates the Glide library for efficient image loading and GIF support in native ads. Requires Glide v4.4 or higher. Add the specified dependencies to your `build.gradle` file. ```gradle dependencies { // Glide 사용시 compile 'com.github.bumptech.glide:glide:4.+' annotationProcessor 'com.github.bumptech.glide:compiler:4.+' } ``` -------------------------------- ### Create NativeAdViewBinder Source: https://docs.adpies.com/android/integration/native Creates a `NativeAdViewBinder` object to map the layout IDs defined in XML to the corresponding native ad elements (icon, title, description, main image, CTA, opt-out). This is crucial for the SDK to populate the ad correctly. ```java NativeAdViewBinder viewBinder = new NativeAdViewBinder.Builder(R.layout.adpie_native_ad) // Layout ID .setIconImageId(R.id.native_ad_icon) // Icon ID .setTitleId(R.id.native_ad_title) // Title ID .setDescriptionId(R.id.native_ad_description) // Description ID .setMainId(R.id.native_ad_main) // Main ID .setCallToActionId(R.id.native_ad_cta) // Call-To-Action ID .setOptOutId(R.id.native_optout) // Opt-out ID .build(); ``` -------------------------------- ### Define Native Ad XML Layout Source: https://docs.adpies.com/android/integration/native Defines the layout structure for native ads, specifying the placement of elements like icon, title, description, main image, and call-to-action button. Refer to the SDK's template for guidance. ```xml