Google Mobile Ads SDK को एआई टूल (बीटा वर्शन) के साथ इंटिग्रेट करना

Android Studio में Gemini को ऑप्टिमाइज़ करने के लिए, अपने प्रोजेक्ट में AGENTS.md फ़ाइल का इस्तेमाल करें. अपने प्रोजेक्ट में AGENTS.md फ़ाइल जोड़कर, Gemini को Google Mobile Ads SDK से जुड़ा कॉन्टेक्स्ट दिया जाता है. इससे, एआई की मदद से कोड जनरेट करने की सुविधा के आउटपुट को बेहतर बनाया जा सकता है. ज़्यादा जानकारी के लिए, AGENTS.md फ़ाइलों का इस्तेमाल करके Gemini को अपनी पसंद के मुताबिक बनाएं लेख पढ़ें.

इस गाइड में, Google Mobile Ads SDK के लिए Android Studio में Gemini को ऑप्टिमाइज़ करने के बारे में बताया गया है.

शुरू करने से पहले

जारी रखने से पहले, यह काम करें:

अपने प्रोजेक्ट में AGENTS.md फ़ाइल जोड़ना

Google, Gemini के लिए निर्देशों वाली एक AGENTS.md फ़ाइल उपलब्ध कराता है. इससे आपको इंटिग्रेशन के इन चरणों को पूरा करने में मदद मिलती है:

  • अपने प्रोजेक्ट में Google Mobile Ads SDK जोड़ें.
  • बैनर विज्ञापन लागू करें.

एआई की मदद से कोड लिखने की सुविधा में, Google Mobile Ads SDK से जुड़े निर्देशों का इस्तेमाल करने के लिए, यह तरीका अपनाएं:

  1. अपने प्रोजेक्ट के फ़ाइल सिस्टम में कहीं भी AGENTS.md नाम की नई फ़ाइल बनाएं.

  2. अपनी 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 फ़ाइल कॉन्फ़िगर करने के बाद, Android Studio में Gemini को एजेंट मोड में प्रॉम्प्ट किया जा सकता है.

एजेंट मोड में, प्रॉम्प्ट के इन उदाहरणों का इस्तेमाल किया जा सकता है:

एसडीके टूल को इंटिग्रेट करना

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 विषयों पर उनके जवाबों को बेहतर बनाया जा सकेगा.

अगर आपको Google Mobile Ads SDK के लिए Gemini को ऑप्टिमाइज़ करने के बारे में कोई सुझाव/राय देनी है या शिकायत करनी है, तो Google Mobile Ads SDK Discord चैनल से जुड़ें.