ปุ่มตำแหน่งหลัก

  
อัปเดตล่าสุด รุ่นที่เสถียร รุ่นที่อาจได้รับการเผยแพร่ รุ่นเบต้า รุ่นอัลฟ่า
17 มิถุนายน 2026 - - - -

การประกาศทรัพยากร Dependency

หากต้องการเพิ่มทรัพยากร Dependency ในปุ่มตำแหน่งหลัก คุณต้องเพิ่มที่เก็บ Maven ของ Google ลงในโปรเจ็กต์ อ่านข้อมูลเพิ่มเติมได้ที่ที่เก็บ Maven ของ Google

เพิ่มทรัพยากร Dependency สำหรับอาร์ติแฟกต์ที่ต้องการในไฟล์ build.gradle ของแอปหรือโมดูล

ดึงดูด

dependencies {
    implementation "androidx.core.locationbutton:locationbutton:"
    implementation "androidx.core.locationbutton:locationbutton-compose:"
    implementation "androidx.core.locationbutton:locationbutton-testing:"
}

Kotlin

dependencies {
    implementation("androidx.core.locationbutton:locationbutton:")
    implementation("androidx.core.locationbutton:locationbutton-compose:")
    implementation("androidx.core.locationbutton:locationbutton-testing:")
}

ดูข้อมูลเพิ่มเติมเกี่ยวกับทรัพยากร Dependency ได้ที่หัวข้อเพิ่มทรัพยากร Dependency ในการบิลด์

ความคิดเห็น

ความคิดเห็นของคุณช่วยให้ Jetpack ดีขึ้น โปรดแจ้งให้เราทราบหากพบปัญหาใหม่หรือมีไอเดียในการปรับปรุงไลบรารีนี้ โปรดดู ปัญหาที่มีอยู่แล้ว ในไลบรารีนี้ก่อนสร้างปัญหาใหม่ คุณสามารถโหวตปัญหาที่มีอยู่แล้วได้โดยคลิกปุ่มรูปดาว

สร้างปัญหาใหม่

ดูข้อมูลเพิ่มเติมได้ในเอกสารประกอบของIssue Tracker

เวอร์ชัน 1.0

เวอร์ชัน 1.0.0-alpha01

17 มิถุนายน 2026

เราได้เผยแพร่ androidx.core.locationbutton:locationbutton:1.0.0-alpha01, androidx.core.locationbutton:locationbutton-compose:1.0.0-alpha01 และ androidx.core.locationbutton:locationbutton-testing:1.0.0-alpha01 แล้ว เวอร์ชัน 1.0.0-alpha01 มี คอมมิตต่อไปนี้

ฟีเจอร์ใหม่

การเผยแพร่รุ่นอัลฟ่าเริ่มต้นของการใช้งาน LocationButton ใน AndroidX ซึ่งช่วยให้แอปพลิเคชันที่ใช้ทั้ง View และ Compose สามารถขอสิทธิ์เข้าถึงตำแหน่งที่แน่นอนแบบครั้งเดียวได้อย่างง่ายดาย สำหรับอุปกรณ์ที่ใช้ Android 16 (API 36) หรือต่ำกว่า ไลบรารีจะมีความเข้ากันได้แบบย้อนหลังโดยอัตโนมัติด้วยการแสดงข้อความแจ้งขอสิทธิ์เข้าถึงตำแหน่งมาตรฐาน

การเปลี่ยนแปลง API

  • เพิ่ม LocationButton View เป็นจุดเริ่มต้นสำหรับแอปพลิเคชันที่ใช้ View เป็นหลัก
  • เพิ่ม LocationButton Composable เป็นจุดเริ่มต้นสำหรับแอปพลิเคชันที่ใช้ Compose เป็นหลัก
  • เพิ่ม OnPermissionResultListener, OnErrorListener และ OnRequestPermissionsListener สำหรับการจัดการการเรียกกลับ
  • เพิ่ม TestLocationButtonProvider เพื่อให้แอปทดสอบโฟลว์ที่ใช้ LocationButton ที่ปลอดภัยได้