ภาพรวมของไลบรารี Google Play Core

หน้านี้อธิบายเกี่ยวกับไลบรารี Google Play Core และวิธีเพิ่มไลบรารีลงใน

ไลบรารี Google Play Core เป็นอินเทอร์เฟซรันไทม์ของแอปคุณด้วย Google Play Store ตัวอย่างสิ่งที่คุณทำได้มีดังนี้

ไลบรารี Play Core มีให้บริการใน Java เนทีฟ และ Unity สำหรับข้อมูลเพิ่มเติม เกี่ยวกับรุ่นล่าสุด โปรดดู บันทึกประจำรุ่น

การย้ายข้อมูลจาก Play Core Java และไลบรารี Kotlin

มีการแบ่งพาร์ติชันไลบรารี Play Core Java และ Kotlin ออกเป็น และไลบรารี Android แต่ละฟีเจอร์ การดำเนินการนี้จะลดขนาดของไลบรารี Play Core ที่เพิ่มลงใน แอปของคุณและช่วยให้รอบการเผยแพร่ฟีเจอร์แต่ละรายการเร็วขึ้น

ลักษณะการทำงานของแต่ละฟีเจอร์ยังคงมีความสม่ำเสมอในการย้ายข้อมูลครั้งนี้ การเปลี่ยนแปลงที่เห็นได้ชัดคือเวอร์ชันใหม่นำบริการ Google Play Task API

ใช้รายการด้านล่างเพื่อย้ายข้อมูลไปยังไลบรารีใหม่และใช้ประโยชน์จากฟีเจอร์ใหม่ๆ และแก้ไขข้อบกพร่องต่างๆ หากคุณใช้หลายฟีเจอร์ของ Play คุณสามารถนำเข้า ในไฟล์ build.gradle พร้อมกัน

ขั้นตอนการย้ายข้อมูลทั่วไป

  1. อัปเดตคำสั่งการนำเข้าที่มีอยู่ของออบเจ็กต์งานจาก import com.google.android.play.core.tasks.*; เป็น import com.google.android.gms.tasks.*; ชื่อคลาสทั้งหมดไม่มีการเปลี่ยนแปลง
  2. นำการนำเข้าไลบรารี Play Core เก่าในไฟล์ build.gradle ออก

ผสานรวมไลบรารีการนำส่งเนื้อหา Play

ดึงดูด

// In your app’s build.gradle file:
...
dependencies {
    // This dependency is downloaded from the Google’s Maven repository.
    // So, make sure you also include that repository in your project's build.gradle file.
    implementation 'com.google.android.play:asset-delivery:2.2.2'

    // For Kotlin users also add the Kotlin extensions library for Play Asset Delivery:
    implementation 'com.google.android.play:asset-delivery-ktx:2.2.2'
    ...
}

Kotlin

// In your app’s build.gradle.kts file:
...
dependencies {
    // This dependency is downloaded from the Google’s Maven repository.
    // So, make sure you also include that repository in your project's build.gradle file.
    implementation("com.google.android.play:asset-delivery:2.2.2")

    // For Kotlin users also import the Kotlin extensions library for Play Asset Delivery:
    implementation("com.google.android.play:asset-delivery-ktx:2.2.2")
    ...
}

ผสานรวมไลบรารีการนำส่งฟีเจอร์ Play

ดึงดูด

// In your app’s build.gradle file:
...
dependencies {
    // This dependency is downloaded from the Google’s Maven repository.
    // So, make sure you also include that repository in your project's build.gradle file.
    implementation 'com.google.android.play:feature-delivery:2.1.0'

    // For Kotlin users, also add the Kotlin extensions library for Play Feature Delivery:
    implementation 'com.google.android.play:feature-delivery-ktx:2.1.0'
    ...
}

Kotlin

// In your app’s build.gradle.kts file:
...
dependencies {
    // This dependency is downloaded from the Google’s Maven repository.
    // Make sure you also include that repository in your project's build.gradle file.
    implementation("com.google.android.play:feature-delivery:2.1.0")

    // For Kotlin users, also import the Kotlin extensions library for Play Feature Delivery:
    implementation("com.google.android.play:feature-delivery-ktx:2.1.0")
    ...
}

ผสานรวมไลบรารีการรีวิวในแอปของ Play

ดึงดูด

// In your app’s build.gradle file:
...
dependencies {
    // This dependency is downloaded from the Google’s Maven repository.
    // Make sure you also include that repository in your project's build.gradle file.
    implementation 'com.google.android.play:review:2.0.1'

    // For Kotlin users, also add the Kotlin extensions library for Play In-App Review:
    implementation 'com.google.android.play:review-ktx:2.0.1'
    ...
}

Kotlin

// In your app’s build.gradle.kts file:
...
dependencies {
    // This dependency is downloaded from the Google’s Maven repository.
    // Make sure you also include that repository in your project's build.gradle file.
    implementation("com.google.android.play:review:2.0.1")

    // For Kotlin users, also import the Kotlin extensions library for Play In-App Review:
    implementation("com.google.android.play:review-ktx:2.0.1")
    ...
}

ผสานรวมไลบรารีการอัปเดตในแอปของ Play

ดึงดูด

// In your app’s build.gradle file:
...
dependencies {
    // This dependency is downloaded from the Google’s Maven repository.
    // Make sure you also include that repository in your project's build.gradle file.
    implementation 'com.google.android.play:app-update:2.1.0'

    // For Kotlin users, also add the Kotlin extensions library for Play In-App Update:
    implementation 'com.google.android.play:app-update-ktx:2.1.0'
    ...
}

Kotlin

// In your app’s build.gradle.kts file:
...
dependencies {
    // This dependency is downloaded from the Google’s Maven repository.
    // Make sure you also include that repository in your project's build.gradle file.
    implementation("com.google.android.play:app-update:2.1.0")

    // For Kotlin users, also import the Kotlin extensions library for Play In-App Update:
    implementation("com.google.android.play:app-update-ktx:2.1.0")
    ...
}

ข้อกำหนดในการให้บริการของ Play Core Software Development Kit

แก้ไขล่าสุด: 24 กันยายน 2020
  1. การใช้ชุดเครื่องมือพัฒนาซอฟต์แวร์หลักของ Play หมายความว่าคุณยอมรับข้อกำหนดเหล่านี้เพิ่มเติมจากข้อกำหนดในการให้บริการของ Google APIs ("ข้อกำหนดในการให้บริการของ API") หากข้อกำหนดเหล่านี้มีความขัดแย้งกัน ข้อกำหนดเหล่านี้จะมีความสำคัญเหนือกว่าข้อกำหนดในการให้บริการของ API โปรดอ่านข้อกำหนดเหล่านี้และข้อกำหนดในการให้บริการของ API อย่างละเอียด
  2. สำหรับวัตถุประสงค์ของข้อกำหนดเหล่านี้ "API" หมายถึง API ของ Google, บริการสำหรับนักพัฒนาซอฟต์แวร์อื่นๆ และซอฟต์แวร์ที่เกี่ยวข้อง รวมถึงโค้ด Redistributable ใดๆ
  3. "โค้ดที่ทำซ้ำได้" หมายถึงโค้ดออบเจ็กต์ที่ Google จัดเตรียมให้หรือไฟล์ส่วนหัวที่เรียกใช้ API
  4. คุณคัดลอกและแจกจ่ายโค้ด Redistributable เพื่อการรวมไว้ในไคลเอ็นต์ API ได้โดยอยู่ภายใต้ข้อกําหนดเหล่านี้และข้อกําหนดของข้อกำหนดในการให้บริการของ API Google และผู้อนุญาตเป็นเจ้าของสิทธิ์ กรรมสิทธิ์ และผลประโยชน์ทั้งหมด รวมถึงทรัพย์สินทางปัญญาใดๆ ทั้งหมดและกรรมสิทธิ์อื่นๆ ในและในโค้ดที่ทำซ้ำได้ คุณจะไม่แก้ไข แปล หรือสร้างผลงานลอกเลียนแบบของรหัส Redistributable
  5. Google อาจทำการเปลี่ยนแปลงข้อกำหนดเหล่านี้ได้ทุกเมื่อโดยมีการแจ้งให้ทราบและมีโอกาสที่จะปฏิเสธการใช้งานชุดพัฒนาซอฟต์แวร์หลักของ Play ต่อไป Google จะโพสต์ประกาศแจ้งการเปลี่ยนแปลงข้อกำหนดที่ https://developer.android.com/guide/playcore/license การเปลี่ยนแปลงจะไม่มีผลย้อนหลัง