Play Install Referrer API
จัดทุกอย่างให้เป็นระเบียบอยู่เสมอด้วยคอลเล็กชัน
บันทึกและจัดหมวดหมู่เนื้อหาตามค่ากำหนดของคุณ
เอกสารประกอบนี้ให้ข้อมูลอ้างอิงทางเทคนิคสําหรับการใช้ Play Install Referrer API Play Install Referrer API เป็นAIDL Service Interface ที่ใช้โดยโปรแกรมเมอร์ที่ไม่ใช่ Java เป็นหลัก
หมายเหตุ: ไลบรารี Play Install Referrer มี Wrapper สำหรับ Play Install Referrer API และออกแบบมาเพื่อช่วยโปรแกรมเมอร์ Java ใช้ API
เมธอด getInstallReferrer()
วิธีนี้จะแสดงผลข้อมูลอ้างอิงการติดตั้งแอปซึ่งสอดคล้องกับชื่อแพ็กเกจที่ระบุซึ่งส่งผ่าน Bundle
(คีย์ที่แมปในตารางที่ 1) ในคําตอบ Bundle
ที่ Google Play ส่งมา ระบบจะจัดเก็บข้อมูลอ้างอิงในช่องที่แมปกับคีย์ที่ระบุไว้ในตาราง 2
ตารางที่ 1 getInstallReferrer()
ข้อมูลแพ็กเกจ
คำขอ
พารามิเตอร์
|
ประเภท
|
คำอธิบาย
|
package_name
|
String
|
ชื่อแพ็กเกจของผู้เรียกใช้ ซึ่งใช้เพื่อคลายความกำกวม
|
ตารางที่ 2 ข้อมูลการตอบกลับจากgetInstallReferrer()
คำขอ
คีย์
|
ประเภท
|
คำอธิบาย
|
install_referrer
|
String
|
URL ที่มาของแพ็กเกจที่ติดตั้ง
|
referrer_click_timestamp_seconds
|
long
|
การประทับเวลาฝั่งไคลเอ็นต์เป็นวินาทีเมื่อเกิดการคลิก URL ที่มา
|
install_begin_timestamp_seconds
|
long
|
การประทับเวลาฝั่งไคลเอ็นต์เป็นวินาทีเมื่อเริ่มการติดตั้งแอป
|
referrer_click_timestamp_server_seconds
|
long
|
การประทับเวลาฝั่งเซิร์ฟเวอร์เป็นวินาทีเมื่อเกิดการคลิก URL ที่มา
|
install_begin_timestamp_server_seconds
|
long
|
การประทับเวลาฝั่งเซิร์ฟเวอร์เป็นวินาทีเมื่อเริ่มการติดตั้งแอป
|
install_version
|
string
|
เวอร์ชันของแอป ณ เวลาที่ติดตั้งแอปครั้งแรก
|
google_play_instant
|
boolean
|
ระบุว่ามีการเปิดใช้ประสบการณ์การใช้งาน Instant ของแอปในช่วง 7 วันที่ผ่านมาหรือไม่
|
ข้อควรระวัง: ข้อมูลอ้างอิงการติดตั้งจะพร้อมใช้งานเป็นเวลา 90 วันและจะไม่เปลี่ยนแปลง เว้นแต่จะมีการติดตั้งแอปพลิเคชันอีกครั้ง คุณควรเรียกใช้ API เพียงครั้งเดียวระหว่างการเรียกใช้ครั้งแรกหลังจากติดตั้ง เพื่อหลีกเลี่ยงการเรียก API ที่ไม่จำเป็นในแอป
ตัวอย่างเนื้อหาและโค้ดในหน้าเว็บนี้ขึ้นอยู่กับใบอนุญาตที่อธิบายไว้ในใบอนุญาตการใช้เนื้อหา Java และ OpenJDK เป็นเครื่องหมายการค้าหรือเครื่องหมายการค้าจดทะเบียนของ Oracle และ/หรือบริษัทในเครือ
อัปเดตล่าสุด 2025-07-27 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-27 UTC"],[],[],null,["# Play Install Referrer API\n\nThis documentation provides technical reference for using the\nPlay Install Referrer API. The Play Install Referrer API is an\n[AIDL Service Interface](https://developer.android.com/guide/components/aidl.html)\nprimarily used by non-Java programmers.\n\n\n**Note:** The\n[Play Install Referrer Library](/google/play/installreferrer/library)\nprovides a wrapper around the Play Install Referrer API and is designed to help Java\nprogrammers use the API.\n\nThe getInstallReferrer() method\n-------------------------------\n\nThis method returns the app install referrer information corresponding to the\ngiven package name sent through a `Bundle` (key mapped in table 1). In the\nresponse `Bundle` sent by Google Play, the referral information is stored in\nfields mapped to the keys detailed in table 2.\n\n\n**Table 1.** `getInstallReferrer()` bundle data\nrequest.\n\n| Parameter | Type | Description |\n|----------------|----------|----------------------------------------------------------|\n| `package_name` | `String` | The package name of the caller, used for disambiguation. |\n\n\n**Table 2.** Response data from a `getInstallReferrer()`\nrequest.\n\n| Key | Type | Description |\n|-------------------------------------------|-----------|--------------------------------------------------------------------------------------|\n| `install_referrer` | `String` | The referrer URL of the installed package. |\n| `referrer_click_timestamp_seconds` | `long` | The client-side timestamp, in seconds, when the referrer click happened. |\n| `install_begin_timestamp_seconds` | `long` | The client-side timestamp, in seconds, when app installation began. |\n| `referrer_click_timestamp_server_seconds` | `long` | The server-side timestamp, in seconds, when the referrer click happened. |\n| `install_begin_timestamp_server_seconds` | `long` | The server-side timestamp, in seconds, when app installation began. |\n| `install_version` | `string` | The app's version at the time when the app was first installed. |\n| `google_play_instant` | `boolean` | Indicates whether your app's instant experience was launched within the past 7 days. |\n\n**Caution:** The install referrer information will be\navailable for 90 days and **won't change** unless the application is\nreinstalled. To avoid unnecessary API calls in your app, you should invoke the\nAPI **only once** during the first execution after install."]]