ตั้งแต่วันที่ 27 มีนาคม 2025 เป็นต้นไป เราขอแนะนำให้ใช้ android-latest-release
แทน aosp-main
เพื่อสร้างและมีส่วนร่วมใน AOSP โปรดดูข้อมูลเพิ่มเติมที่หัวข้อการเปลี่ยนแปลงใน AOSP
ข้อมูลระบุตัวตนของผู้ให้บริการ
จัดทุกอย่างให้เป็นระเบียบอยู่เสมอด้วยคอลเล็กชัน
บันทึกและจัดหมวดหมู่เนื้อหาตามค่ากำหนดของคุณ
อุปกรณ์ที่ใช้ Android 9 จะจดจำข้อมูลผู้ให้บริการเพื่อระบุรหัสและชื่อผู้ให้บริการได้ Android ดูแลฐานข้อมูลรหัสผู้ให้บริการ โดยมีกฎการจับคู่สำหรับผู้ให้บริการแต่ละรายและรหัสผู้ให้บริการที่ไม่ซ้ำกัน AOSP มีเนื้อหาของฐานข้อมูลรหัสผู้ให้บริการในไฟล์ carrier_list.textpb
ฐานข้อมูลที่รวมศูนย์จะลดตรรกะซ้ำในแอปที่ต้องระบุผู้ให้บริการและจำกัดการแสดงแอตทริบิวต์ที่ระบุผู้ให้บริการ
Android รองรับการอัปเดตตารางรหัสผู้ให้บริการและนอกแบนด์เพื่อปรับปรุงความครอบคลุมและความแม่นยำในการระบุผู้ให้บริการ การอัปเดตแต่ละครั้งจะมีหมายเลขเวอร์ชันและเผยแพร่ไปยัง AOSP
การใช้งาน
ผู้ใช้ที่ต้องการใช้การอัปเดตนอกช่องทางสามารถดาวน์โหลดไฟล์ไบนารีจาก AOSP ได้
carrier_list.pb
หากต้องการดูตารางในรูปแบบที่อ่านได้ โปรดดู
carrier_list.textpb
วางตารางรหัสผู้ให้บริการในพาร์ติชันข้อมูล /data/misc/carrierid/
ของอุปกรณ์ หากตารางรหัสผู้ให้บริการใหม่กว่าเวอร์ชันที่มีอยู่ อุปกรณ์จะเก็บตารางไว้ในคลาสฐานข้อมูลรหัสผู้ให้บริการ
ข้อมูลล่าสุดจากฐานข้อมูลรหัสผู้ให้บริการขนส่งจะได้รับการดึงข้อมูลโดยวิธีสาธารณะ getSimCarrierId()
และ getSimCarrierIdName()
หากต้องการเพิ่มหรืออัปเดตรหัสผู้ให้บริการลงในฐานข้อมูล ให้ส่งคำขอโดยใช้แบบฟอร์มข้อมูลระบุตัวตนของผู้ให้บริการ
คำขอของคุณจะได้รับการตรวจสอบ และหากได้รับอนุมัติ ระบบจะพุชการเปลี่ยนแปลงไปยังฐานโค้ด AOSP ที่ carrier_list.pb
จากนั้นคุณสามารถคัดลอกรายการที่อัปเดตแล้วและรวมไว้ในบิลด์ที่กําหนดเอง
ผสานรวมรหัสผู้ให้บริการกับ CarrierConfig
ตั้งแต่ Android 10 เป็นต้นไป การกำหนดค่าของผู้ให้บริการจะรองรับการใช้รหัสผู้ให้บริการเป็นคีย์ในการดึงข้อมูลการกำหนดค่าเฉพาะผู้ให้บริการจาก CarrierService
การผสานรวมรหัสผู้ให้บริการกับ CarrierConfig
มีข้อดีดังนี้
- รวมคู่ MCC/MNC ทั้งหมดของผู้ให้บริการแต่ละรายไว้ในที่เดียว โดยนําข้อมูลที่ซ้ำกันหรือไม่สอดคล้องกันออก
- สร้างตัวระบุตามหลักเกณฑ์สําหรับผู้ให้บริการแต่ละรายและลดความคลุมเครือ
- อนุญาตให้ระบุโอเปอเรเตอร์เครือข่ายเสมือนบนอุปกรณ์เคลื่อนที่ (MVNO) ด้วยรหัสแต่ละรหัสแทนการกำหนดค่าเป็นส่วนหนึ่งของโอเปอเรเตอร์เครือข่ายมือถือ (MNO)
ย้ายข้อมูลการกำหนดค่าไปยังรหัสผู้ให้บริการ
หากต้องการย้ายข้อมูลการกำหนดค่าจากคู่ MCC/MNC ไปยังรหัสผู้ให้บริการ ให้ทำตามขั้นตอนต่อไปนี้
จัดกลุ่มไฟล์ carrier_config_mccmnc.xml
จากผู้ให้บริการรายเดียวไว้ด้วยกัน
ใช้ carrier_list.textpb
เป็นข้อมูลอ้างอิงในการแมปข้อมูล MCC, MNC และ MVNO กับผู้ให้บริการรายใดรายหนึ่ง
ผสานการกําหนดค่าเข้าด้วยกันเป็นไฟล์เดียว
(ไม่บังคับ) รับค่าจาก MNO MVNO จะรับค่าการกำหนดค่าจาก MNO ในไฟล์ carrier_config_mccmnc.xml
เดิม เนื่องจากรหัสผู้ให้บริการอนุญาตให้ผู้ให้บริการทุกราย รวมถึง MVNO มีไฟล์การกําหนดค่าเฉพาะ จึงขอแนะนําให้รวมข้อมูล MNO ในระหว่างการย้ายข้อมูล
หากไม่มีการกำหนดค่าสำหรับรหัสผู้ให้บริการ MVNO ให้ดึงข้อมูลการกำหนดค่าจากรหัสผู้ให้บริการ MNO โดยใช้ getCarrierIdFromSimMccMnc
เปลี่ยนชื่อไฟล์ใหม่เป็น
carrier_config_carrierid_carrierid_carriername.xml
โดยที่ carrierid ต้องตรงกับ canonical_id
และ
carriername ควรตรงกับ carrier_name
ใน
carrier_list.textpb
ตัวอย่างเนื้อหาและโค้ดในหน้าเว็บนี้ขึ้นอยู่กับใบอนุญาตที่อธิบายไว้ในใบอนุญาตการใช้เนื้อหา Java และ OpenJDK เป็นเครื่องหมายการค้าหรือเครื่องหมายการค้าจดทะเบียนของ Oracle และ/หรือบริษัทในเครือ
อัปเดตล่าสุด 2025-07-26 UTC
[[["เข้าใจง่าย","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-07-26 UTC"],[],[],null,["# Carrier identification\n\nDevices running Android 9 can recognize subscription\ncarrier information to\nprovide an ID and a carrier name. Android maintains a carrier ID database, with\nmatching rules for each carrier and its unique carrier ID. AOSP includes the\ncontent of the carrier ID database, in the file\n[`carrier_list.textpb`](https://android.googlesource.com/platform/packages/providers/TelephonyProvider/+/android16-release/assets/latest_carrier_id/carrier_list.textpb).\nThe unified database minimizes duplicate logic in apps that need to identify\ncarriers and limits the exposure of carrier-identifying attributes.\n\nTo improve the coverage and accuracy of carrier identification, Android supports\nout-of-band and carrier ID table updates. Each update comes with a version\nnumber and is published to AOSP.\n\nImplementation\n--------------\n\nUsers who want to implement out-of-band updates can download the\n[`carrier_list.pb`](https://android.googlesource.com/platform/packages/providers/TelephonyProvider/+/android16-release/assets/latest_carrier_id/carrier_list.pb)\nbinary from AOSP. To view the readable format of the table, see\n[`carrier_list.textpb`](https://android.googlesource.com/platform/packages/providers/TelephonyProvider/+/android16-release/assets/latest_carrier_id/carrier_list.textpb).\n\nPlace the carrier ID table in the `/data/misc/carrierid/` data partition of the\ndevice. If the carrier ID table is newer than the existing version, the device\npersists the table to the\n[carrier ID database class](https://developer.android.com/reference/android/provider/Telephony.CarrierId).\nThe most recent information from the carrier ID database is picked up by the\npublic methods\n[`getSimCarrierId()`](https://developer.android.com/reference/android/telephony/TelephonyManager#getSimCarrierId())\nand\n[`getSimCarrierIdName()`](https://developer.android.com/reference/android/telephony/TelephonyManager#getSimCarrierIdName()).\n\nAdd carrier ID information to the database\n------------------------------------------\n\nTo add or update a carrier ID to the database, submit a request using the\n[Carrier identification information form](https://docs.google.com/forms/d/1KjwTaExKRjkE9tbR9yavBrGzwvuz1dNku2Ae_7GrdUQ/viewform?edit_requested=true).\n\nYour request is reviewed and if approved, the change is pushed to the AOSP code\nbase at\n[`carrier_list.pb`](https://android.googlesource.com/platform/packages/providers/TelephonyProvider/+/android16-release/assets/latest_carrier_id/carrier_list.pb).\nYou can then copy the updated list and incorporate it into your customized\nbuild.\n\nIntegrate carrier IDs with CarrierConfig\n----------------------------------------\n\nStarting from Android 10,\n[carrier configuration](/docs/core/connect/carrier) supports\nusing carrier IDs as keys to fetch carrier-specific configurations from\n[`CarrierService`](https://developer.android.com/reference/android/service/carrier/CarrierService).\n\nIntegrating carrier IDs with `CarrierConfig` has the following advantages:\n\n- Consolidates all MCC/MNC pairs for each carrier into a single location removing duplicate or inconsistent data.\n- Creates a canonical identifier for each carrier and removes ambiguity.\n- Allows mobile virtual network operators (MVNOs) to be identified with individual IDs instead of having configurations as part of a mobile network operator (MNO).\n\n### Migrate configuration data to carrier IDs\n\nTo migrate configuration data from MCC/MNC pairs to carrier IDs, follow\nthese steps:\n\n1. Group the `carrier_config_mccmnc.xml` files from a single carrier together.\n Use\n [`carrier_list.textpb`](https://android.googlesource.com/platform/packages/providers/TelephonyProvider/+/android16-release/assets/latest_carrier_id/carrier_list.textpb)\n as a reference to map the MCC, MNC, and MVNO information to a particular\n carrier.\n\n2. Merge the configurations into a single file.\n\n3. (Optional) Inherit data from MNOs. MVNOs inherit configurations from\n MNOs in the legacy `carrier_config_mccmnc.xml` file. Because carrier IDs\n allow all carriers including MVNOs to have a dedicated config file, it's\n recommended to include MNO data during migration.\n\n4. If the configuration for an MVNO carrier ID doesn't exist, fetch the\n configuration from its MNO carrier ID using\n [`getCarrierIdFromSimMccMnc`](https://developer.android.com/reference/android/telephony/TelephonyManager#getCarrierIdFromSimMccMnc()).\n\n5. Rename the new file as\n `carrier_config_carrierid_`\u003cvar translate=\"no\"\u003ecarrierid\u003c/var\u003e`_`\u003cvar translate=\"no\"\u003ecarriername\u003c/var\u003e`.xml`\n where \u003cvar translate=\"no\"\u003ecarrierid\u003c/var\u003e must correspond to a `canonical_id` and\n \u003cvar translate=\"no\"\u003ecarriername\u003c/var\u003e should correspond to a `carrier_name` in\n [`carrier_list.textpb`](https://android.googlesource.com/platform/packages/providers/TelephonyProvider/+/android16-release/assets/latest_carrier_id/carrier_list.textpb)\n\n| **Note:** If a `carrier_config_mccmnc` file doesn't have a matching carrier ID, submit a request to add a carrier ID by following the steps in [Adding carrier ID information to the database](#adding_carrier_id_information_to_the_database)."]]