با مجموعهها، منظم بمانید
ذخیره و طبقهبندی محتوا براساس اولویتهای شما.
Firebase Cloud Messaging
plat_ios
plat_android
plat_web
plat_flutter
plat_cpp
plat_unity
Firebase Cloud Messaging ( FCM ) یک راه حل پیام رسانی بین پلتفرمی است که به شما امکان می دهد به طور قابل اعتماد پیام ارسال کنید.
با استفاده از
FCM ، میتوانید به برنامه مشتری اطلاع دهید که ایمیل جدید یا دادههای دیگر برای همگامسازی در دسترس است. میتوانید پیامهای اعلان ارسال کنید تا باعث جذب مجدد و حفظ کاربر شود. برای موارد استفاده مانند پیامرسانی فوری، یک پیام میتواند حجمی تا 4096 بایت را به یک برنامه مشتری منتقل کند.
برای شروع آماده اید؟ پلتفرم خود را انتخاب کنید:
iOS+ Android Web Flutter
Unity C++
قابلیت های کلیدی
پیام های اعلان یا پیام های داده ارسال کنید | پیام های اعلان را که برای کاربر نمایش داده می شود ارسال کنید. یا پیام های داده ارسال کنید و به طور کامل تعیین کنید که در کد برنامه شما چه اتفاقی می افتد. انواع پیام را ببینید. |
هدف گذاری پیام همه کاره | پیامها را به هر یک از 3 روش در برنامه مشتری خود توزیع کنید—به دستگاههای منفرد، به گروههایی از دستگاهها یا به دستگاههایی که در موضوعات مشترک هستند. |
چگونه کار می کند؟
پیاده سازی FCM شامل دو جزء اصلی برای ارسال و دریافت است:
- یک محیط قابل اعتماد مانند Cloud Functions for Firebase یا یک سرور برنامه که بر روی آن میتوان پیامها را ساخت، هدفگیری و ارسال کرد.
- یک برنامه مشتری اپل، اندروید یا وب (جاوا اسکریپت) که پیام ها را از طریق سرویس حمل و نقل مخصوص پلت فرم مربوطه دریافت می کند.
می توانید از طریق Firebase Admin SDK یا پروتکل سرور FCM پیام ارسال کنید. میتوانید از سازنده اعلانها برای آزمایش و ارسال پیامهای بازاریابی یا تعامل با استفاده از هدفگیری و تجزیه و تحلیل داخلی قدرتمند یا بخشهای وارداتی سفارشی استفاده کنید.
برای جزئیات بیشتر و اطلاعات مهم در مورد اجزای FCM به نمای کلی معماری مراجعه کنید.
مسیر پیاده سازی
| FCM SDK را تنظیم کنید | Firebase و FCM بر اساس دستورالعملهای راهاندازی پلتفرم خود در برنامه خود راهاندازی کنید. |
| برنامه مشتری خود را توسعه دهید | مدیریت پیام، منطق اشتراک موضوع یا سایر ویژگی های اختیاری را به برنامه مشتری خود اضافه کنید. در طول توسعه، می توانید به راحتی پیام های آزمایشی را از سازنده Notifications ارسال کنید. |
| سرور برنامه خود را توسعه دهید | تصمیم بگیرید که آیا می خواهید Firebase Admin SDK یا پروتکل سرور برای ایجاد منطق ارسال خود استفاده کنید - منطق برای احراز هویت، ساخت درخواست های ارسال، رسیدگی به پاسخ ها و غیره. سپس منطق را در محیط مورد اعتماد خود بسازید. |
مراحل بعدی
نمونه شروع سریع اندروید یا iOS را اجرا کنید. این نمونهها به شما امکان میدهند کد را اجرا و مرور کنید تا با استفاده از کنسول Firebase یک پیام آزمایشی به یک دستگاه واحد ارسال کنید.
درباره FCM از نمای کلی معماری ، راهنماهای مفاهیم کلیدی FCM ، و راهنمای بهترین شیوه برای ارسال پیام در مقیاس و مدیریت نشانه های ثبت اطلاعات بیشتر بیاموزید.
آموزش های اندروید یا iOS را امتحان کنید.
Firebase Cloud Messaging به برنامه اندروید ، اپل یا وب خود اضافه کنید.
محیط مورد اعتماد خود را راه اندازی کنید که در آن درخواست های پیام را بسازید و ارسال کنید. میتوانید منطق ارسال را با استفاده از Admin SDK بنویسید و به راحتی آن کد را در Cloud Functions for Firebase یا سایر محیطهای ابری تحت مدیریت Google مستقر کنید. از طرف دیگر، می توانید توسعه سرور را با استفاده از پروتکل سرور FCM انجام دهید.
جز در مواردی که غیر از این ذکر شده باشد،محتوای این صفحه تحت مجوز Creative Commons Attribution 4.0 License است. نمونه کدها نیز دارای مجوز Apache 2.0 License است. برای اطلاع از جزئیات، به خطمشیهای سایت Google Developers مراجعه کنید. جاوا علامت تجاری ثبتشده Oracle و/یا شرکتهای وابسته به آن است.
تاریخ آخرین بهروزرسانی 2025-08-15 بهوقت ساعت هماهنگ جهانی.
[null,null,["تاریخ آخرین بهروزرسانی 2025-08-15 بهوقت ساعت هماهنگ جهانی."],[],[],null,["Firebase Cloud Messaging \nplat_ios plat_android plat_web plat_flutter plat_cpp plat_unity \nFirebase Cloud Messaging (FCM) is a cross-platform messaging solution that lets you reliably send\nmessages. \nUsing FCM, you can notify a client app that new email or other data is available to sync. You can send notification messages to drive user re-engagement and retention. For use cases such as instant messaging, a message can transfer a payload of up to 4096 bytes to a client app.\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\nReady to get started? Choose your platform:\n\n[iOS+](/docs/cloud-messaging/ios/client)\n[Android](/docs/cloud-messaging/android/client)\n[Web](/docs/cloud-messaging/js/client)\n[Flutter](/docs/cloud-messaging/flutter/client)\n\n[Unity](/docs/cloud-messaging/unity/client)\n[C++](/docs/cloud-messaging/cpp/client)\n\nKey capabilities\n\n|---------------------------------------------|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| Send notification messages or data messages | Send notification messages that are displayed to your user. Or send data messages and determine completely what happens in your application code. See [Message types](/docs/cloud-messaging/concept-options#notifications_and_data_messages). |\n| Versatile message targeting | Distribute messages to your client app in any of 3 ways---to single devices, to groups of devices, or to devices subscribed to topics. |\n\nHow does it work?\n\n\u003cbr /\u003e\n\nAn FCM implementation includes two main components for\nsending and receiving:\n\n1. A trusted environment such as Cloud Functions for Firebase or an app server on which to build, target, and send messages.\n2. An Apple, Android, or web (JavaScript) client app that receives messages via the corresponding platform-specific transport service.\n\n\u003cbr /\u003e\n\nYou can send messages via\nthe [Firebase Admin SDK](/docs/cloud-messaging/server#firebase-admin-sdk-for-fcm) or the\n[FCM server protocol](/docs/cloud-messaging/server#choose).\nYou can use [the Notifications composer](//console.firebase.google.com/project/_/notification) for testing and to send marketing or engagement\nmessages using powerful built-in targeting and analytics or custom\n[imported segments](/docs/projects/import-segments).\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\nSee the [architectural\noverview](/docs/cloud-messaging/fcm-architecture) for more detail and important\ninformation about the components of FCM.\n\n\u003cbr /\u003e\n\nImplementation path\n\n|---|-------------------------|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| | Set up the FCM SDK | Set up Firebase and FCM on your app according to the setup instructions for your platform. |\n| | Develop your client app | Add message handling, topic subscription logic, or other optional features to your client app. During the development, you can easily send test messages from [the Notifications composer](//console.firebase.google.com/project/_/notification). |\n| | Develop your app server | Decide whether you want to use the Firebase Admin SDK or the server protocol to create your sending logic---logic to authenticate, build send requests, handle responses, and so on. Then build out the logic in your trusted environment. |\n\nNext steps\n\n- Run the [Android](https://github.com/firebase/quickstart-android/tree/master/messaging)\n or [iOS](https://github.com/firebase/quickstart-ios/tree/master/messaging/)\n Quickstart sample. These samples let you run and review code to send a test\n message to a single device using the Firebase console.\n\n- Learn more about FCM from the\n [architecture overview](/docs/cloud-messaging/fcm-architecture),\n guides to key [FCM concepts](/docs/cloud-messaging/concept-options),\n and best practices guides for [sending messages at scale](/docs/cloud-messaging/scale-fcm)\n and [managing registration tokens](/docs/cloud-messaging/manage-tokens).\n\n- Try the tutorials for [Android](/docs/cloud-messaging/android/first-message)\n or [iOS](/docs/cloud-messaging/ios/first-message).\n\n- Add Firebase Cloud Messaging to your\n [Android](/docs/cloud-messaging/android/client),\n [Apple](/docs/cloud-messaging/ios/client),\n or [Web](/docs/cloud-messaging/js/client) app.\n\n- Set up your trusted environment where you'll build and send message requests.\n You can write sending logic using the\n [Admin SDK](/docs/cloud-messaging/server#firebase-admin-sdk-for-fcm), and\n readily deploy that code on Cloud Functions for Firebase or other cloud\n environments managed by Google.\n Alternatively, you can perform server development using the\n [FCM server protocol](/docs/cloud-messaging/server#choose)."]]