SDK تبلیغات موبایل Google Proxy Charles را در Android N یا بالاتر تنظیم کنید
با مجموعهها، منظم بمانید
ذخیره و طبقهبندی محتوا براساس اولویتهای شما.
در Android N یا بالاتر، تماسهای تبلیغاتی در پراکسی Charles تنها زمانی قابل مشاهده هستند که مراحل زیر انجام شود:
- سرویسهای Google Play را در دستگاه تلفن همراه بهروزرسانی کنید.
- ردیابی شبکه را در دستگاه تلفن همراه فعال کنید.
- گواهی Charles SSL را روی دستگاه خود نصب کنید و پروکسی را راه اندازی کنید.
- پروکسی SSL را برای برنامه تلفن همراه خود فعال کنید.
سرویسهای Google Play را در دستگاه تلفن همراه بهروزرسانی کنید
برای شبیهساز، اگر بخش Google Play را در منوی کناری نمیبینید، ممکن است لازم باشد Android Studio را بهروزرسانی کنید و آخرین تصاویر سیستم را در پیکربندی دستگاه مجازی دانلود کنید. مطمئن شوید که از یک تصویر سیستم با Google Play در هدف خود استفاده می کنید.

از منوی کناری برای بررسی و به روز رسانی سرویس های Google Play به آخرین نسخه استفاده کنید. حداقل نسخه فعال خدمات Google Play 14.5.74
است.

برای یک دستگاه تلفن همراه فیزیکی (تلفن یا تبلت)، میتوانید Google Play را جستجو کنید یا این پیوند را دنبال کنید تا مستقیماً Google Play را باز کنید.
ردیابی شبکه را در دستگاه تلفن همراه فعال کنید
برای فعال کردن ردیابی شبکه، باید گزینه های توسعه دهنده را برای دستگاه خود فعال کنید . برنامه تنظیمات Google را راه اندازی کنید و Google > Ads > Enable debug logging برای تبلیغات را انتخاب کنید. راهنمای دقیقتری برای ناشران AdMob و Google Ad Manager در دسترس است.

گواهی Charles SSL را روی دستگاه خود نصب کنید و پروکسی را راه اندازی کنید
برای استفاده از چارلز به عنوان یک پروکسی برای برنامه تلفن همراه خود، باید چارلز را بر روی رایانه دانلود و نصب کنید . دستورالعمل های چارلز را برای نصب گواهی SSL روی شبیه ساز اندروید یا دستگاه تلفن همراه دنبال کنید.

استفاده از شبیه ساز با پراکسی ساده تر است زیرا شبیه ساز قبلاً به همان شبکه Wi-Fi با رایانه ای که چارلز را اجرا می کند متصل است. هنگام استفاده از شبیه ساز با پراکسی، پروکسی را روی localhost ( http://127.0.0.1
) و پورتی که پراکسی چارلز روی آن اجرا می کند (در گزینه منوی Charles Proxy > Proxy Settings یافت می شود) تنظیم کنید.
اگر از یک دستگاه تلفن همراه فیزیکی (تلفن یا رایانه لوحی) استفاده میکنید، باید با استفاده از تنظیمات شبکه پیشرفته، دستگاه تلفن همراه را به همان شبکه Wi-Fi با رایانهتان که چارلز را اجرا میکند وصل کنید. هنگام تنظیم تنظیمات پراکسی برای دستگاه فیزیکی خود، از گزینه منوی چارلز Help > Local IP address برای دریافت آدرس IP رایانه خود استفاده کنید تا آدرس پراکسی دستگاه خود را وارد کنید (برای این کار باید در همان شبکه Wi-Fi باشید). از پورتی که پراکسی چارلز روی آن اجرا می شود استفاده کنید.
پروکسی SSL را برای برنامه تلفن همراه خود فعال کنید
برای اینکه چارلز بتواند ترافیک SSL برنامه تلفن همراه شما را رهگیری کند، باید اعلام کنید که برنامه شما می تواند به گواهی SSL ارائه شده توسط کاربر اعتماد کند.
ابتدا باید یک فایل منبع XML جدید برای پیکربندی امنیت شبکه در زیر اضافه کنید
<network-security-config>
<debug-overrides>
<trust-anchors>
<!-- Trust user added CAs while debuggable only -->
<certificates src="user" />
</trust-anchors>
</debug-overrides>
</network-security-config>

در مرحله بعد، فایل AndroidManifest.xml
را برای استفاده از پیکربندی امنیت شبکه به روز کنید.
<?xml version="1.0" encoding="utf-8"?>
<manifest ... >
<application ...
android:networkSecurityConfig="@xml/network_security_config"
... >
...
</application>
</manifest>

پس از آن، می توانید برنامه تلفن همراه را راه اندازی کنید و به دنبال درخواست های تبلیغاتی در لاگ Charles بگردید.
جز در مواردی که غیر از این ذکر شده باشد،محتوای این صفحه تحت مجوز Creative Commons Attribution 4.0 License است. نمونه کدها نیز دارای مجوز Apache 2.0 License است. برای اطلاع از جزئیات، به خطمشیهای سایت Google Developers مراجعه کنید. جاوا علامت تجاری ثبتشده Oracle و/یا شرکتهای وابسته به آن است.
تاریخ آخرین بهروزرسانی 2025-09-03 بهوقت ساعت هماهنگ جهانی.
[[["درک آسان","easyToUnderstand","thumb-up"],["مشکلم را برطرف کرد","solvedMyProblem","thumb-up"],["غیره","otherUp","thumb-up"]],[["اطلاعاتی که نیاز دارم وجود ندارد","missingTheInformationINeed","thumb-down"],["بیشازحد پیچیده/ مراحل بسیار زیاد","tooComplicatedTooManySteps","thumb-down"],["قدیمی","outOfDate","thumb-down"],["مشکل ترجمه","translationIssue","thumb-down"],["مشکل کد / نمونهها","samplesCodeIssue","thumb-down"],["غیره","otherDown","thumb-down"]],["تاریخ آخرین بهروزرسانی 2025-09-03 بهوقت ساعت هماهنگ جهانی."],[[["\u003cp\u003eOn Android N or higher, specific steps are required to view ad calls in Charles proxy, including updating Google Play services, enabling network tracing, installing the Charles SSL certificate, and configuring SSL proxy settings for your app.\u003c/p\u003e\n"],["\u003cp\u003eFor successful network tracing, ensure your Google Play services version is at least 14.5.74 and enable debug logging for ads within the Google Settings app.\u003c/p\u003e\n"],["\u003cp\u003eInstalling the Charles SSL certificate requires downloading Charles on your computer and following the instructions provided to install the certificate on your emulator or mobile device.\u003c/p\u003e\n"],["\u003cp\u003eWhen using Charles proxy, ensure your mobile device and computer are on the same Wi-Fi network and correctly configure proxy settings using either localhost for emulators or your computer's local IP address for physical devices.\u003c/p\u003e\n"],["\u003cp\u003eTo enable Charles to intercept SSL traffic from your mobile app, you need to declare trust for user-provided SSL certificates by adding a network security configuration XML file and updating your app's AndroidManifest.xml file.\u003c/p\u003e\n"]]],[],null,["On Android N or higher, ad calls are visible in Charles proxy only when the\nfollowing steps are performed:\n\n1. Update the Google Play services on the mobile device.\n2. Enable Network Tracing on the mobile device.\n3. Install Charles SSL certificate on your device, and set up proxy.\n4. Enable SSL Proxy for your mobile app.\n\nUpdate the Google Play services on the mobile device\n\nFor an emulator, if you don't see the Google Play section in the side menu,\nyou may need to update the Android Studio and download the latest system\nimages in the **Virtual Device Configuration**. Make sure to use a system\nimage with Google Play in its target.\n\nUse the side menu to check and update Google Play services to the latest\nversion. The minimum working version of the Google Play services is\n`14.5.74`.\n\nFor a physical mobile device (phone or tablet), you can search for Google\nPlay or follow this\n[link](//play.google.com/store/apps/details?id=com.google.android.gms)\nto open Google Play directly.\n\nEnable Network Tracing on the mobile device\n\nTo enable network tracing, you will need to [enable developer\noptions](//developer.android.com/studio/debug/dev-options) for your\ndevice. Launch the Google Settings app and select **Google \\\u003e Ads \\\u003e Enable\ndebug logging for ads** . A more detailed\n[guide](/admob/android/network-tracing) is\navailable for both AdMob and Google Ad Manager publishers.\n\nInstall Charles SSL certificate on your device, and set up proxy\n\nTo use Charles as a proxy for your mobile app, you will need to download and\n[install](//www.charlesproxy.com/documentation/installation/) Charles\non a computer. Follow Charles' instructions to install an SSL certificate on\nthe Android emulator or mobile device.\n\nIt is simpler to [use the emulator with a\nproxy](//developer.android.com/studio/run/emulator-networking#proxy) because the\nemulator is already connected to the same Wi-Fi network with the computer\nrunning Charles. When using the emulator with a proxy, set the proxy to\nlocalhost (`http://127.0.0.1`) and the port that Charles proxy is running on\n(found in Charles menu option **Proxy \\\u003e Proxy Settings**).\n\nIf you're using a physical mobile device (phone or tablet), you'll need to\nconnect the mobile device to the same Wi-Fi network with your computer\nrunning Charles using the [advanced network\nsettings](//support.google.com/pixelphone/answer/2819519). When setting up the\nproxy settings for your physical device, use the Charles menu option **Help \\\u003e\nLocal IP address** to get the IP address of your computer, to enter for the proxy\naddress on your device (you must be on the same Wi-Fi network for this to work).\nUse the port that Charles proxy is running on.\n\nEnable SSL Proxy for your mobile app\n\nFor Charles to intercept your mobile app's SSL traffic, you will need to declare\nthat your app can trust a user-provided SSL certificate.\n\nFirst, you will need to add a new XML resource file for [Network Security\nConfiguration](//developer.android.com/training/articles/security-config) under \n\n \u003cnetwork-security-config\u003e\n \u003cdebug-overrides\u003e\n \u003ctrust-anchors\u003e\n \u003c!-- Trust user added CAs while debuggable only --\u003e\n \u003ccertificates src=\"user\" /\u003e\n \u003c/trust-anchors\u003e\n \u003c/debug-overrides\u003e\n \u003c/network-security-config\u003e\n\nNext, update the `AndroidManifest.xml` file to use the network security\nconfiguration. \n\n \u003c?xml version=\"1.0\" encoding=\"utf-8\"?\u003e\n \u003cmanifest ... \u003e\n \u003capplication ...\n android:networkSecurityConfig=\"@xml/network_security_config\"\n ... \u003e\n ...\n \u003c/application\u003e\n \u003c/manifest\u003e\n\nAfter that, you can launch the mobile app and look for ad requests in the\nCharles log."]]