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

หน้านี้อธิบายไลบรารีหลักของ Google Play และวิธีเพิ่มไลบรารีลงในโปรเจ็กต์

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

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

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

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

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

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

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

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

ผสานรวมไลบรารี Play Asset Delivery

Groovy

// 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.3.0'

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

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.3.0")

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

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

Groovy

// 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

Groovy

// 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.2'

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

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.2")

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

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

Groovy

// 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

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