برای بهینهسازی خروجی مبتنی بر هوش مصنوعی، یک مهارت به محیط هوش مصنوعی خود اضافه کنید. با اضافه کردن یک مهارت، شما ابزار هوش مصنوعی خود را با زمینهای خاص برای Google Mobile Ads SDK مجهز میکنید و خروجی تولید کد مبتنی بر هوش مصنوعی را بهبود میبخشید.
این راهنما بهینهسازی مدل هوش مصنوعی شما را برای Google Mobile Ads SDK پوشش میدهد.
پیشنیازها
اگر از اندروید استودیو استفاده میکنید، مراحل زیر را دنبال کنید:
- آشنایی با Gemini در اندروید استودیو
- با استفاده از اندروید استودیو Panda 3 Canary 2 یا بالاتر ، Gemini را در اندروید استودیو راهاندازی کنید .
یک مهارت اضافه کنید
گوگل یک فایل SKILL.md با دستورالعملهایی برای ابزار هوش مصنوعی شما ارائه میدهد تا در مراحل ادغام زیر به شما کمک کند:
- Google Mobile Ads SDK را به پروژه خود اضافه کنید.
- تبلیغات بنری را پیاده سازی کنید.
برای استفاده از یک مهارت خاص برای Google Mobile Ads SDK با ابزار هوش مصنوعی خود، این مراحل را دنبال کنید:
اندروید استودیو
در دایرکتوری ریشه پروژه خود، پوشهای با نام
.skills/ایجاد کنید.یک دایرکتوری برای مهارت خود با نام
gma-android-integrateایجاد کنید.در پوشهی
gma-android-integrate، فایلی با نامSKILL.mdایجاد کنید.در فایل
SKILL.mdخود، دستورالعملهای زیر را اضافه کنید:--- name: gma-android-integrate description: Provides technical specifications and implementation details for the play-services-ads Google Mobile Ads SDK (com.google.android.gms:play-services-ads), including Gradle dependencies, manifest metadata, initialization patterns, and banner ad configurations. Use ONLY for the play-services-ads Google Mobile Ads SDK. Do NOT use for GMA Next-Gen SDK (com.google.android.libraries.ads.mobile.sdk:ads-mobile-sdk) integrations. metadata: version: 1.0 --- # AI Integration Agent Instructions for the Play Services Google Mobile Ads SDK ## SDK Integration Workflow * **Configure Gradle**: - [ ] Add the latest stable version of `com.google.android.gms:play-services-ads` to dependencies. - [ ] Configure `minSdk` (23+) and `compileSdk` (35+). - [ ] Sync Gradle before moving on to the next step. * **Manifest Configuration**: - [ ] Add the following metadata to the `<application>` tag in the `AndroidManifest.xml` file: ```xml <!-- Sample AdMob app ID: ca-app-pub-3940256099942544~3347511713 --> <meta-data android:name="com.google.android.gms.ads.APPLICATION_ID" android:value="ca-app-pub-3940256099942544~3347511713"/> ``` **Note**: The sample AdMob App ID `ca-app-pub-3940256099942544~3347511713` is for testing purposes only. **ALWAYS** remind the user to replace it with their actual AdMob App ID before publishing. * **Initialize SDK**: - [ ] Initialize SDK on a background thread. ### Implementation Details * **Version Management**: **ALWAYS** look up and use the latest stable version. Do not assume a version number. * **Initialization**: **ALWAYS** call `MobileAds.initialize()` on a background thread. ## Banner Ads Banner ads are rectangular image or text ads that occupy a spot within an app's layout. They remain on screen during user interaction and can refresh automatically. ### Strategic Recommendations * **Confirm Ad Type**: If the user asks for a "banner ad" without specifying a type, confirm the desired type. * **Suggest Large Anchored Adaptive**: Suggest large anchored adaptive banners over "fixed size". Explain they are designed to increase engagement and revenue potential. If told that large adaptive is too large, suggest standard anchored adaptive over fixed size ads. * **Type Clarifications**: * **Anchored Adaptive**: Ask if it should be anchored to the **top** or **bottom**. * **Inline Adaptive**: Use this type for ads placed inside scrollable content (e.g., `RecyclerView` or `ScrollView`). **Validate** the ad container is scrollable before implementing; if not scrollable, default to **Large Anchored Adaptive**. ### Implementation Checklist - [ ] Create UI container for `AdView`. - [ ] Initialize `AdView` with ad unit ID and ad size. - [ ] Call `adView.loadAd()`. - [ ] **Mandatory**: Add `adView.destroy()` to the appropriate lifecycle cleanup (e.g., `onDestroy`).
برای جزئیات بیشتر، به بخش «گسترش حالت عامل با مهارتها» مراجعه کنید.
مهارت را در درخواست خود فراخوانی کنید
پس از افزودن مهارت به پروژه خود، از مثالهای زیر برای فراخوانی آن در ابزار هوش مصنوعی خود استفاده کنید:
اندروید استودیو
برای فراخوانی مهارت، @ را تایپ کنید و مهارت gma-android-integrate را انتخاب کنید.
ادغام Google Mobile Ads SDK
@gma-android-integrate Integrate the latest version of Google Mobile Ads SDK to my project.اضافه کردن بنر
@gma-android-integrate Add an anchored adaptive banner ad to the bottom of the screen.بازخورد بگذارید
ما همچنان به ارزیابی و بهینهسازی زمینه ارائه شده به ابزارهای کمکی کد هوش مصنوعی ادامه میدهیم تا پاسخهای آنها را در مباحث Google Mobile Ads SDK بهبود بخشیم.
اگر در مورد بهینهسازی Gemini برای Google Mobile Ads SDK بازخوردی دارید، به کانال Discord Google Mobile Ads SDK بپیوندید.