لتحسين أداء "Gemini في استوديو Android"، استخدِم ملف AGENTS.md في مشروعك.
من خلال إضافة ملف AGENTS.md إلى مشروعك، يمكنك تزويد Gemini بسياق خاص Google Mobile Ads SDK وتحسين نتائج إنشاء الرموز البرمجية بمساعدة الذكاء الاصطناعي. لمزيد من التفاصيل، يُرجى الاطّلاع على تخصيص Gemini باستخدام AGENTS.md
الملفات.
يتناول هذا الدليل كيفية تحسين أداء Gemini في "استوديو Android" من أجل Google Mobile Ads SDK.
قبل البدء
قبل المتابعة، يُرجى اتّباع الخطوات التالية:
- مزيد من المعلومات حول Gemini في "استوديو Android"
- إعداد Google Mobile Ads SDK باستخدام إصدار متوافق من "استوديو Android"
إضافة ملف AGENTS.md إلى مشروعك
توفّر Google ملف AGENTS.md يتضمّن تعليمات لـ Gemini لمساعدتك في خطوات الدمج التالية:
- أضِف Google Mobile Ads SDK إلى مشروعك.
- استخدِم إعلانات البانر.
لاستخدام تعليمات خاصة بـ Google Mobile Ads SDK في ميزة "مساعدة الذكاء الاصطناعي في كتابة التعليمات البرمجية"، اتّبِع الخطوات التالية:
أنشئ ملفًا جديدًا باسم
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 في "وضع الوكيل"
بعد ضبط ملف AGENTS.md، يمكنك توجيه طلب إلى "Gemini في استوديو Android"
في وضع الوكيل.
في "وضع الوكيل"، يمكنك استخدام الأمثلة التالية على الطلبات:
دمج حزمة تطوير البرامج (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.
تقديم تعليقات
نواصل تقييم السياق المقدَّم لأدوات المساعدة في الترميز المستنِد إلى الذكاء الاصطناعي وتحسينه من أجل تحسين ردودها بشأن مواضيع Google Mobile Ads SDK.
إذا كان لديك ملاحظات حول تحسين Gemini لـ Google Mobile Ads SDK، يمكنك الانضمام إلى Google Mobile Ads SDK قناة Discord.