หากต้องการเพิ่มประสิทธิภาพเอาต์พุตที่ AI ช่วยสร้าง ให้เพิ่มทักษะลงในสภาพแวดล้อม AI การเพิ่มทักษะจะช่วยให้เครื่องมือ AI ได้รับบริบทที่เฉพาะเจาะจงกับGoogle Mobile Ads SDK และปรับปรุงเอาต์พุตของการสร้างโค้ดที่ AI ช่วยสร้าง
คู่มือนี้ครอบคลุมการเพิ่มประสิทธิภาพโมเดล AI สำหรับ Google Mobile Ads SDK
ข้อกำหนดเบื้องต้น
หากคุณใช้ Android Studio ให้ทำดังนี้
- ดูข้อมูลเกี่ยวกับ Gemini ใน Android Studio
- ตั้งค่า Gemini ใน Android Studio โดยใช้ Android Studio Panda 3 Canary 2 ขึ้นไป
เพิ่มทักษะ
Google มีไฟล์ SKILL.md พร้อมวิธีการสำหรับเครื่องมือ AI เพื่อช่วยคุณในขั้นตอนการผสานรวมต่อไปนี้
- เพิ่ม Google Mobile Ads SDK ลงในโปรเจ็กต์
- ใช้โฆษณาแบนเนอร์
หากต้องการใช้ทักษะที่เฉพาะเจาะจงกับ Google Mobile Ads SDK กับเครื่องมือ AI ให้ทำตามขั้นตอนต่อไปนี้
Android Studio
สร้างโฟลเดอร์ชื่อ
.skills/ในไดเรกทอรีรากของโปรเจ็กต์สร้างไดเรกทอรีสำหรับทักษะชื่อ
gma-android-integrateสร้างไฟล์ชื่อ
SKILL.mdในไดเรกทอรีgma-android-integrateเพิ่มวิธีการต่อไปนี้ในไฟล์
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`).
ดูรายละเอียดได้ที่ หัวข้อขยายโหมด Agent ด้วยทักษะ
เรียกใช้ทักษะในพรอมต์
หลังจากเพิ่มทักษะลงในโปรเจ็กต์แล้ว ให้ใช้พรอมต์ตัวอย่างต่อไปนี้เพื่อเรียกใช้ทักษะในเครื่องมือ AI
Android Studio
หากต้องการเรียกใช้ทักษะ ให้พิมพ์ @ แล้วเลือกทักษะ 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.แสดงความคิดเห็น
เรายังคงประเมินและเพิ่มประสิทธิภาพบริบทที่ให้ไว้กับเครื่องมือความช่วยเหลือเกี่ยวกับโค้ดที่ทำงานด้วยระบบ AI เพื่อปรับปรุงการตอบกลับในหัวข้อ Google Mobile Ads SDK
หากมีความคิดเห็นเกี่ยวกับการเพิ่มประสิทธิภาพ Gemini สำหรับ Google Mobile Ads SDK โปรดเข้าร่วม Google Mobile Ads SDK Discord channel