จัดทุกอย่างให้เป็นระเบียบอยู่เสมอด้วยคอลเล็กชัน
บันทึกและจัดหมวดหมู่เนื้อหาตามค่ากำหนดของคุณ
Firebase Cloud Messaging
plat_ios
plat_android
plat_web
plat_flutter
plat_cpp
plat_unity
Firebase Cloud Messaging (FCM) เป็นโซลูชันการรับส่งข้อความข้ามแพลตฟอร์มที่ช่วยให้คุณส่งข้อความได้อย่างน่าเชื่อถือ
เมื่อใช้
FCM คุณจะแจ้งให้แอปไคลเอ็นต์ทราบว่ามีอีเมลใหม่หรือข้อมูลอื่นๆ พร้อมให้ซิงค์แล้ว คุณสามารถส่งข้อความแจ้งเตือนเพื่อกระตุ้นการกลับมามีส่วนร่วมและการคงผู้ใช้ไว้ สำหรับ Use Case เช่นการรับส่งข้อความทันที ข้อความจะโอนเพย์โหลดได้สูงสุด 4096 ไบต์ไปยังแอปไคลเอ็นต์
หากพร้อมที่จะเริ่มแล้ว เลือกแพลตฟอร์มของคุณ
iOS+
Android
เว็บ
Flutter
Unity
C++
ความสามารถหลัก
ส่งข้อความแจ้งเตือนหรือข้อความข้อมูล |
ส่งข้อความแจ้งเตือนที่แสดงต่อผู้ใช้
หรือส่งข้อความข้อมูลและตรวจสอบสิ่งที่เกิดขึ้นได้อย่างละเอียดในโค้ดแอปพลิเคชันของคุณ โปรดดู
ประเภทข้อความ |
การกำหนดเป้าหมายข้อความอเนกประสงค์ |
เผยแพร่ข้อความไปยังแอปไคลเอ็นต์ของคุณด้วยวิธีใดวิธีหนึ่งจาก 3 วิธี ได้แก่ ไปยังอุปกรณ์เครื่องเดียว กลุ่มของอุปกรณ์ หรือไปยังอุปกรณ์ที่สมัครรับข้อมูลหัวข้อ
|
วิธีการทำงาน
การติดตั้งใช้งาน FCM ประกอบด้วยคอมโพเนนต์หลัก 2 อย่างสำหรับการส่งและรับ
- สภาพแวดล้อมที่เชื่อถือได้ เช่น Cloud Functions for Firebase หรือเซิร์ฟเวอร์แอปเพื่อใช้สร้าง กําหนดเป้าหมาย และส่งข้อความ
- แอปไคลเอ็นต์ Apple, Android หรือเว็บ (JavaScript) ที่ได้รับข้อความผ่านบริการขนส่งเฉพาะแพลตฟอร์มที่เกี่ยวข้อง
คุณส่งข้อความได้ผ่าน Firebase Admin SDK หรือโปรโตคอลเซิร์ฟเวอร์ FCM
คุณสามารถใช้
เครื่องมือเขียนข้อความแจ้งเตือนเพื่อทดสอบและส่งข้อความการตลาดหรือการมีส่วนร่วมโดยใช้การกำหนดเป้าหมายและข้อมูลวิเคราะห์ในตัวที่มีประสิทธิภาพ หรือกลุ่มที่นำเข้าที่กำหนดเอง
ดูรายละเอียดเพิ่มเติมและข้อมูลสําคัญเกี่ยวกับคอมโพเนนต์ของ FCM ได้ที่ภาพรวมสถาปัตยกรรม
เส้นทางการใช้งาน
|
ตั้งค่า FCM SDK |
ตั้งค่า Firebase และ FCM ในแอปตามวิธีการตั้งค่าสำหรับแพลตฟอร์มของคุณ |
|
พัฒนาแอปไคลเอ็นต์ |
เพิ่มการจัดการข้อความ ตรรกะการติดตามหัวข้อ หรือฟีเจอร์อื่นๆ ที่ไม่บังคับลงในแอปไคลเอ็นต์ ในระหว่างการพัฒนา คุณสามารถส่งข้อความทดสอบจาก
เครื่องมือเขียนข้อความแจ้งเตือนได้อย่างง่ายดาย |
|
พัฒนาเซิร์ฟเวอร์แอป |
ตัดสินใจว่าคุณต้องการใช้ Firebase Admin SDK หรือโปรโตคอลเซิร์ฟเวอร์เพื่อสร้างตรรกะการส่ง ซึ่งก็คือตรรกะในการตรวจสอบสิทธิ์ สร้างคําขอส่ง จัดการการตอบกลับ และอื่นๆ จากนั้นสร้างตรรกะในสภาพแวดล้อมที่เชื่อถือได้ |
ขั้นตอนถัดไป
เนื้อหาของหน้าเว็บนี้ได้รับอนุญาตภายใต้ใบอนุญาตที่ต้องระบุที่มาของครีเอทีฟคอมมอนส์ 4.0 และตัวอย่างโค้ดได้รับอนุญาตภายใต้ใบอนุญาต Apache 2.0 เว้นแต่จะระบุไว้เป็นอย่างอื่น โปรดดูรายละเอียดที่นโยบายเว็บไซต์ Google Developers Java เป็นเครื่องหมายการค้าจดทะเบียนของ Oracle และ/หรือบริษัทในเครือ
อัปเดตล่าสุด 2025-08-17 UTC
[null,null,["อัปเดตล่าสุด 2025-08-17 UTC"],[],[],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)."]]