หากต้องการเพิ่มประสิทธิภาพ Gemini ใน Android Studio ให้ใช้ไฟล์ AGENTS.md ในโปรเจ็กต์
การเพิ่มAGENTS.mdไฟล์ลงในโปรเจ็กต์จะช่วยให้ Gemini มีบริบท
ที่เฉพาะเจาะจงกับ Google Mobile Ads SDK และปรับปรุงเอาต์พุตของโค้ดที่ AI ช่วย
สร้าง โปรดดูรายละเอียดที่หัวข้อปรับแต่ง Gemini โดยใช้ไฟล์ AGENTS.md
คู่มือนี้ครอบคลุมการเพิ่มประสิทธิภาพ Gemini ใน Android Studio สำหรับ Google Mobile Ads SDK
ก่อนเริ่มต้น
ก่อนดำเนินการต่อ ให้ทำดังนี้
- ดูเกี่ยวกับ Gemini ใน Android Studio
- ตั้งค่า Google Mobile Ads SDK โดยใช้ Android Studio เวอร์ชันที่เข้ากันได้
เพิ่มไฟล์ AGENTS.md ลงในโปรเจ็กต์
Google มีAGENTS.mdไฟล์ที่มีวิธีการสำหรับ Gemini เพื่อช่วยคุณ
ในขั้นตอนการผสานรวมต่อไปนี้
- เพิ่ม Google Mobile Ads SDK ลงในโปรเจ็กต์
- ใช้โฆษณาแบนเนอร์
หากต้องการใช้คำสั่งที่เฉพาะเจาะจงในGoogle Mobile Ads SDKในความช่วยเหลือด้านโค้ด AI ให้ทำตาม ขั้นตอนต่อไปนี้
สร้างไฟล์ใหม่ชื่อ
AGENTS.mdที่ใดก็ได้ในระบบไฟล์ของโปรเจ็กต์เพิ่มคำสั่งต่อไปนี้ในไฟล์
AGENTS.md
# AI Integration Agent Instructions for the Google Mobile Ads SDK ## Integrate the SDK * When I ask to integrate the Google Mobile Ads SDK, **always** use the latest stable version for `com.google.android.gms:play-services-ads`. * After looking up the latest stable version of `com.google.android.gms:play-services-ads`, **always** check the project for a version catalog to manage dependencies. * Make sure the project meets the SDK requirements of `minSdk` 23 or higher and `compileSdk` of 35 or higher. * **Always** make sure there is a `<metadata>` tag for application ID in the project. If it's not there, add it. * You MUST initialize the Google Mobile Ads SDK on a background thread, as recommended in the Google Mobile Ads SDK v24.0.0 release notes. ## Banner Ads * When I ask to implement a banner ad or something similar, without specifying a type, **always** follow up to confirm the type of ad. * When I ask for an "anchored adaptive" ad, ask me if I want the ad anchored to the top or bottom of the screen. * When I ask for an "inline" adaptive banner ad, explain that inline adaptive ads are used for scrolling content. If my application has no scrollable view elements (e.g. `ScrollView` or `List`), default to implement an anchored adaptive banner ad. * When I ask for a "collapsible" banner ad, create an extra parameter that aligns the expanded ad to the `AdView`. Ask me if I want the ad collapsed to the top or bottom. * When I ask for a "fixed size" banner ad, **always** ask me if I'm sure or would I like to implement an anchored adaptive banner ad. Explain why anchored adaptive banner ads perform better than fixed size ads. * **Mandatory `AdView` Implementation Steps:** * **Always** provide the code for a UI container intended to host the `AdView`. * **Always** call `adView.destroy()` to prevent memory leaks.
ป้อนพรอมต์ Gemini ในโหมด Agent
หลังจากกำหนดค่าไฟล์ AGENTS.md แล้ว คุณจะแจ้ง Gemini ใน Android Studio
ในโหมด Agent ได้
ในโหมดตัวแทน คุณสามารถใช้พรอมต์ตัวอย่างต่อไปนี้
ผสานรวม SDK
Integrate the latest version of the GMA SDK to my project. Refer to the Android
documentation.
เพิ่มแบนเนอร์
Add an anchored adaptive banner ad to the bottom of the screen. Refer to the
Android documentation.
แสดงความคิดเห็น
เรายังคงประเมินและเพิ่มประสิทธิภาพบริบทที่ให้ไว้กับเครื่องมือช่วยเขียนโค้ด AI เพื่อปรับปรุงคำตอบเกี่ยวกับGoogle Mobile Ads SDK
หากมีความคิดเห็นเกี่ยวกับการเพิ่มประสิทธิภาพ Gemini สำหรับ Google Mobile Ads SDK โปรดเข้าร่วม Google Mobile Ads SDK ช่อง Discord