בדף הזה מתוארות ספריות Google Play Core ומוסבר איך להוסיף אותן לפרויקט.
ספריות Google Play Core הן ממשק זמן הריצה של האפליקציה עם חנות Google Play. הנה כמה מהדברים שאפשר לעשות:
- הורדת משאבי שפה נוספים
- ניהול ההעברה של מודולים של תכונות
- ניהול ההעברה של חבילות נכסים
- הפעלת עדכונים לאפליקציה בתוך האפליקציה
- בקשת ביקורות בתוך האפליקציה
ספריות Play Core זמינות ב-Java, ב-Native וב-Unity. למידע נוסף על הגרסאות האחרונות, קראו את נתוני הגרסה.
מעבר מספריית Play Core Java ו-Kotlin
ספריית Play Core Java and Kotlin חולקה לכמה ספריות Android לכל תכונה. כך אפשר להקטין את הנפח שספריות Play Core מוסיפות לאפליקציה, ולקצר את מחזורי ההשקה של התכונות השונות.
ההתנהגות של כל תכונה נשארה עקבית בהעברה הזו. השינוי היחיד שראוי לציון הוא שבגרסאות החדשות הוטמע Task API של Google Play Services.
כדאי להשתמש ברשימה הבאה כדי לעבור לספריות החדשות וליהנות מתכונות חדשות ומתיקוני באגים. אם אתם משתמשים בכמה תכונות של Play, אתם יכולים לייבא כמה ספריות בקובץ build.gradle בבת אחת.
שלבים נפוצים בתהליך ההעברה
- מעדכנים את כל הצהרות הייבוא הקיימות של אובייקטים מסוג Task מ-
import com.google.android.play.core.tasks.*;ל-import com.google.android.gms.tasks.*;. כל שמות הכיתות לא השתנו. - מסירים את כל הייבואים של ספריות Play Core הישנות בקובץ
build.gradle.
שילוב של ספריית Play Asset Delivery
מגניב
// 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"
מגניב
// 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-App Review
מגניב
// 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
מגניב
// 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") ... }
התנאים וההגבלות של ערכת פיתוח התוכנה (SDK) של Play Core
תאריך השינוי האחרון: 24 בספטמבר 2020- השימוש בערכת כלים לפיתוח תוכנה (SDK) של Play Core מבטא את הסכמתך לתנאים האלה בנוסף לתנאים ולהגבלות של Google APIs ("התנאים וההגבלות של ה-API"). אם תהיה סתירה בין התנאים האלה, התנאים האלה יקבלו עדיפות על פני התנאים וההגבלות של ה-API. חשוב לקרוא בעיון את התנאים האלה ואת התנאים וההגבלות של ה-API.
- למטרות התנאים האלה, "ממשקי API" הם ממשקי ה-API של Google, שירותים אחרים למפתחים ותוכנות משויכות, כולל כל קוד שניתן להפצה חוזרת.
- "קוד שניתן להפצה חוזרת" פירושו קוד אובייקט או קובצי כותרת ש-Google מספקת, שמפעילים את ממשקי ה-API.
- בכפוף לתנאים האלה ולתנאים של התנאים וההגבלות של ה-API, מותר לך להעתיק ולהפיץ קוד שניתן להפצה חוזרת רק כדי לכלול אותו כחלק מלקוח ה-API שלך. Google ובעלי הרישיון שלה הם הבעלים של כל הזכויות, הבעלות והזיקה, כולל כל זכויות הקניין הרוחני וזכויות קנייניות אחרות, בקוד שניתן להפצה חוזרת. אין לשנות, לתרגם או ליצור יצירות נגזרות של קוד שניתן להפצה חוזרת.
- Google רשאית לשנות את התנאים האלה בכל שלב, אבל היא חייבת להודיע על כך ולתת הזדמנות לסרב להמשיך להשתמש בערכת כלים לפיתוח תוכנה (SDK) של Play Core. Google תפרסם הודעה לגבי שינויים בתנאים בכתובת https://developer.android.com/guide/playcore/license. השינויים לא יחולו באופן רטרואקטיבי.