เมื่อใช้ Maps SDK สำหรับ Android คุณจะสร้างแอปสำหรับอุปกรณ์สวมใส่ที่อิงตามแผนที่ซึ่งทำงานบนอุปกรณ์ Wear OS by Google ได้โดยตรง ผู้ใช้แอปของคุณจะดูตำแหน่งของตนเองบนแผนที่ได้เพียงแค่เหลือบมองที่ข้อมือ เช่น ผู้ใช้สามารถวางตำแหน่งของตนเองบนเส้นทาง จากนั้นซูมเข้าเพื่อดูรายละเอียด หรือแตะเครื่องหมายเพื่อดูหน้าต่างข้อมูลที่แอปของคุณให้มา
หน้านี้อธิบายฟังก์ชันการทำงานของ API ที่พร้อมใช้งานในอุปกรณ์ Wear และช่วยคุณเริ่มต้นสร้างแอป
เริ่มต้นใช้งาน Wear OS
การสร้างแอปสำหรับอุปกรณ์สวมใส่ด้วย Maps SDK สำหรับ Android นั้นโดยพื้นฐานแล้วเหมือนกับการสร้างแอป Google Maps สำหรับอุปกรณ์ Android อื่นๆ ความแตกต่างอยู่ที่การออกแบบสำหรับอุปกรณ์ที่สวมใส่ได้ที่มีรูปแบบของอุปกรณ์ขนาดเล็กกว่า เพื่อเพิ่มประสิทธิภาพความสามารถในการใช้งานและประสิทธิภาพของแอป
Android Studio เป็นเครื่องมือที่แนะนำสำหรับการพัฒนา Wear OS เนื่องจากมีการตั้งค่าโปรเจ็กต์ การรวมไลบรารี และความสะดวกในการจัดแพ็กเกจ
หากต้องการความช่วยเหลือทั่วไปเกี่ยวกับการออกแบบแอปสำหรับอุปกรณ์สวมใส่ โปรดดูหลักเกณฑ์การออกแบบ Wear OS หากต้องการความช่วยเหลือในการสร้างแอปสำหรับอุปกรณ์สวมใส่แอปแรก โปรดดูคำแนะนำในการสร้างแอปสำหรับอุปกรณ์สวมใส่
การสร้างแอป Maps แอปแรกใน Wear OS
คู่มือฉบับย่อนี้ถือว่าคุณคุ้นเคยกับ Maps SDK สำหรับ Android, ได้ทำตามคู่มือ Wear OS เพื่อสร้างโมดูลอุปกรณ์ที่สวมใส่ได้ในแอป และตอนนี้ต้องการเพิ่มแผนที่ลงในโมดูลอุปกรณ์ที่สวมใส่ได้
การเพิ่มทรัพยากร Dependency สำหรับโมดูล Wear
ตรวจสอบว่าทรัพยากร Dependency ต่อไปนี้รวมอยู่ในไฟล์ build.gradle.kts ของโมดูล Wear OS ของแอป
dependencies { // ... // Modern Android projects use version catalogs to manage dependencies. To include the necessary dependencies, // first add the following to your libs.versions.toml file: // // [versions] // playServicesMaps = "20.1.0" // wear = "1.4.0" // wearable = "2.9.0" // // [libraries] // play-services-maps = { group = "com.google.android.gms", name = "play-services-maps", version.ref = "playServicesMaps" } // wear = { group = "androidx.wear", name = "wear", version.ref = "wear" } // wearable-compile = { group = "com.google.android.wearable", name = "wearable", version.ref = "wearable" } // wearable-support = { group = "com.google.android.support", name = "wearable", version.ref = "wearable" } compileOnly(libs.wearable.compile) implementation(libs.wearable.support) implementation(libs.play.services.maps) // This dependency is necessary for ambient mode implementation(libs.wear) // Android Test Dependencies androidTestImplementation(libs.ext.junit) androidTestImplementation(libs.espresso.core) androidTestImplementation(libs.uiautomator) androidTestImplementation(libs.truth) androidTestImplementation(libs.junit) // If your project does not use a version catalog, you can use the following dependencies instead: // // compileOnly("com.google.android.wearable:wearable:2.9.0") // implementation("com.google.android.support:wearable:2.9.0") // implementation("com.google.android.gms:play-services-maps:20.1.0") // implementation("androidx.wear:wear:1.4.0") // androidTestImplementation("androidx.test.ext:junit:1.3.0") // androidTestImplementation("androidx.test.espresso:espresso-core:3.7.0") // androidTestImplementation("androidx.test.uiautomator:uiautomator:2.3.0") // androidTestImplementation("com.google.truth:truth:1.4.5") // androidTestImplementation("junit:junit:4.13.2") }
ดูข้อมูลเพิ่มเติมเกี่ยวกับการขึ้นต่อกันได้ที่คำแนะนำในการเพิ่มโมดูล Wear OS ในโปรเจ็กต์ที่มีอยู่
การใช้ท่าทางสัมผัสปัดเพื่อปิดและตั้งค่าสีพื้นหลังเริ่มต้น
เราขอแนะนำให้ใช้ SwipeDismissFrameLayout เพื่อแสดงแผนที่บนอุปกรณ์ที่สวมใส่ได้ เมื่อใช้คลาส SwipeDismissFrameLayout คุณจะใช้ท่าทางสัมผัสปัดเพื่อปิดได้ ซึ่งช่วยให้ผู้ใช้มีวิธีออกจากแอปโดยการปัดจากขอบด้านซ้ายสุดของหน้าจอ
หากต้องการตั้งค่าสีพื้นหลังเริ่มต้นที่กำหนดเอง ให้ใช้แอตทริบิวต์ XML map:backgroundColor เพื่อกำหนดสีที่จะแสดงจนกว่าชิ้นส่วนแผนที่จริงจะโหลด
เพิ่มองค์ประกอบ SwipeDismissFrameLayout และ backgroundColor ลงในคำจำกัดความของเลย์เอาต์เป็นคอนเทนเนอร์ของ SupportMapFragment:
<androidx.wear.widget.SwipeDismissFrameLayout
android:id="@+id/map_container"
android:layout_width="match_parent"
android:layout_height="match_parent">
<fragment
android:id="@+id/map"
android:name="com.google.android.gms.maps.SupportMapFragment"
android:layout_width="match_parent"
android:layout_height="match_parent"
map:backgroundColor="#fff0b2dd" />
</androidx.wear.widget.SwipeDismissFrameLayout>เมื่อได้รับออบเจ็กต์ SwipeDismissFrameLayout ในกิจกรรม ให้เพิ่ม Callback และตั้งค่าลักษณะการทำงานของ Callback เพื่อดำเนินการปิดที่จำเป็นตามที่แสดงด้านล่าง
Kotlin
class MainActivity : AppCompatActivity(), OnMapReadyCallback, AmbientModeSupport.AmbientCallbackProvider { public override fun onCreate(savedInstanceState: Bundle?) { super.onCreate(savedInstanceState) // Set the layout. It only contains a SupportMapFragment and a DismissOverlay. setContentView(R.layout.activity_main) // Enable ambient support, so the map remains visible in simplified, low-color display // when the user is no longer actively using the app but the app is still visible on the // watch face. try { val controller = AmbientModeSupport.attach(this) Log.d(MainActivity::class.java.simpleName, "Is ambient enabled: " + controller.isAmbient) } catch (e: Exception) { Log.w(MainActivity::class.java.simpleName, "Ambient mode unavailable on this device: ${e.message}") } // Retrieve the containers for the root of the layout and the map. Margins will need to be // set on them to account for the system window insets. val mapFrameLayout = findViewById<SwipeDismissFrameLayout>(R.id.map_container) mapFrameLayout.addCallback(object : SwipeDismissFrameLayout.Callback() { override fun onDismissed(layout: SwipeDismissFrameLayout) { onBackPressed() } }) // Obtain the MapFragment and set the async listener to be notified when the map is ready. mapFragment = supportFragmentManager .findFragmentById(R.id.map) as SupportMapFragment mapFragment.getMapAsync(this) } // ... }
Java
public class MainActivity extends AppCompatActivity implements OnMapReadyCallback, AmbientModeSupport.AmbientCallbackProvider { public void onCreate(Bundle savedState) { super.onCreate(savedState); // Set the layout. It only contains a SupportMapFragment and a DismissOverlay. setContentView(R.layout.activity_main); // Enable ambient support, so the map remains visible in simplified, low-color display // when the user is no longer actively using the app but the app is still visible on the // watch face. try { AmbientModeSupport.AmbientController controller = AmbientModeSupport.attach(this); Log.d( MainActivity.class.getSimpleName(), "Is ambient enabled: " + controller.isAmbient()); } catch (Exception e) { Log.w( MainActivity.class.getSimpleName(), "Ambient mode unavailable on this device: " + e.getMessage()); } // Retrieve the containers for the root of the layout and the map. Margins will need to be // set on them to account for the system window insets. final SwipeDismissFrameLayout mapFrameLayout = (SwipeDismissFrameLayout) findViewById(R.id.map_container); mapFrameLayout.addCallback( new SwipeDismissFrameLayout.Callback() { @Override public void onDismissed(SwipeDismissFrameLayout layout) { onBackPressed(); } }); // Obtain the MapFragment and set the async listener to be notified when the map is ready. mapFragment = (SupportMapFragment) getSupportFragmentManager().findFragmentById(R.id.map); mapFragment.getMapAsync(this); } // ... }
การเพิ่มแผนที่
ใช้เมธอด Callback onMapReady(GoogleMap) ตามปกติเพื่อรับแฮนเดิลไปยังออบเจ็กต์ GoogleMap ระบบจะเรียกใช้ Callback เมื่อแผนที่พร้อมใช้งาน ในเมธอด Callback คุณสามารถเพิ่มเครื่องหมายหรือเส้นประกอบลงในแผนที่ เพิ่ม Listener หรือย้ายกล้องได้ ตัวอย่างด้านล่างจะเพิ่มเครื่องหมายใกล้กับโรงอุปรากรซิดนีย์
Kotlin
private val sydney = LatLng(-33.85704, 151.21522) override fun onMapReady(googleMap: GoogleMap) { // Add a marker with a title that is shown in its info window. googleMap.addMarker( MarkerOptions().position(sydney) .title("Sydney Opera House"), ) // Move the camera to show the marker. googleMap.moveCamera(CameraUpdateFactory.newLatLngZoom(sydney, 10f)) }
Java
private static final LatLng SYDNEY = new LatLng(-33.85704, 151.21522); @Override public void onMapReady(@NonNull GoogleMap googleMap) { // Add a marker with a title that is shown in its info window. googleMap.addMarker(new MarkerOptions().position(SYDNEY).title("Sydney Opera House")); // Move the camera to show the marker. googleMap.moveCamera(CameraUpdateFactory.newLatLngZoom(SYDNEY, 10)); }
การเปิดใช้โหมดแอมเบียนท์
Maps SDK สำหรับ Android รองรับโหมดแอมเบียนท์สำหรับแอปในอุปกรณ์ที่สวมใส่ได้ บางครั้งแอปที่รองรับโหมดแอมเบียนท์จะเรียกว่าแอปที่เปิดตลอดเวลา โหมดแอมเบียนท์จะเปิดใช้งานเมื่อผู้ใช้ไม่ได้ใช้งานแอปอยู่ และช่วยให้แอปยังคงปรากฏบนอุปกรณ์ที่สวมใส่ได้
Maps SDK สำหรับ Android มีการแสดงผลแผนที่แบบสีน้อยและเรียบง่ายเพื่อใช้ในโหมดแอมเบียนท์ และรูปแบบแผนที่จะปรับโดยอัตโนมัติเมื่ออุปกรณ์เปลี่ยนจากโหมดอินเทอร์แอกทีฟเป็นโหมดแอมเบียนท์ เครื่องหมาย วัตถุ และตัวควบคุม UI ทั้งหมดจะหายไปในโหมดแอมเบียนท์ ซึ่งจะช่วยลดการใช้พลังงานของแอปและทำให้แอปมีรูปลักษณ์ที่สอดคล้องกับแอปอื่นๆ ในโหมดแอมเบียนท์ เช่น หน้าปัด
ทำตามขั้นตอนต่อไปนี้เพื่อให้แอปใช้โหมดแอมเบียนท์ของแผนที่
- อัปเดต Android SDK ให้รวมแพลตฟอร์ม Android 6.0 (API 23) ขึ้นไป ซึ่งมี API ที่ช่วยให้กิจกรรมเข้าสู่โหมดแอมเบียนท์ได้ ดูข้อมูลเกี่ยวกับวิธีอัปเดต SDK ได้ที่เอกสารประกอบของ Android เรื่องการเพิ่มแพ็กเกจ SDK
- ตรวจสอบว่าโปรเจ็กต์กำหนดเป้าหมายเป็น Android 6.0 ขึ้นไปโดยตั้งค่า
targetSdkVersionเป็น 23 ขึ้นไปในไฟล์ Manifest ของแอป - เพิ่มทรัพยากร Dependency ของอุปกรณ์ที่สวมใส่ได้ลงในไฟล์
build.gradle.ktsของแอป ดูตัวอย่างในหน้านี้ - เพิ่มรายการไลบรารีที่ใช้ร่วมกันของอุปกรณ์ที่สวมใส่ได้ลงในไฟล์ Manifest ของแอปสำหรับอุปกรณ์ที่สวมใส่ได้ ตามที่อธิบายไว้ในชั้นเรียนการฝึกอบรม Android เกี่ยวกับการทำให้แอปของคุณมองเห็นได้
- เพิ่มสิทธิ์
WAKE_LOCKลงในไฟล์ Manifest ของแอปสำหรับอุปกรณ์เคลื่อนที่และแอปสำหรับอุปกรณ์สวมใส่ตามที่อธิบายไว้ในชั้นเรียนการฝึกอบรม Android เกี่ยวกับการทำให้แอปของคุณมองเห็นได้ - ในเมธอด
onCreate()ของกิจกรรม ให้เรียกใช้เมธอดAmbientModeSupport.attach()ซึ่งจะบอกระบบปฏิบัติการว่าแอปพลิเคชันเปิดอยู่เสมอ เพื่อที่ว่าเมื่ออุปกรณ์ปิดเครื่อง อุปกรณ์ควรเข้าสู่โหมดแอมเบียนท์แทนที่จะกลับไปที่หน้าปัด - ใช้อินเทอร์เฟซ
AmbientModeSupport.AmbientCallbackProviderในกิจกรรมเพื่อให้รับการเปลี่ยนแปลงสถานะโหมดแอมเบียนท์ได้ - ตั้งค่าแผนที่ให้รองรับโหมดแอมเบียนท์ ซึ่งทำได้โดยตั้งค่าแอตทริบิวต์
map:ambientEnabled="true"ในไฟล์เลย์เอาต์ XML ของกิจกรรม หรือทำแบบเป็นโปรแกรมโดยตั้งค่าGoogleMapOptions.ambientEnabled(true)การตั้งค่านี้จะแจ้งให้ API ทราบว่าต้องโหลดไทล์แผนที่ที่จำเป็นล่วงหน้าเพื่อใช้ในโหมดแอมเบียนท์ - เมื่อกิจกรรมเปลี่ยนเป็นโหมดแอมเบียนท์ ระบบจะเรียกใช้เมธอด
onEnterAmbient()ในAmbientCallbackที่คุณระบุ ลบล้างonEnterAmbient()แล้วโทรหาSupportMapFragment.onEnterAmbient(ambientDetails)หรือMapView.onEnterAmbient(ambientDetails)API จะสลับไปใช้การแสดงผลแผนที่แบบไม่โต้ตอบและมีสีน้อย - ในทำนองเดียวกัน หากอยู่ใน
onExitAmbient()ให้โทรหาSupportMapFragment.onExitAmbient()หรือMapView.onExitAmbient()API จะสลับไปใช้การแสดงผลแผนที่ตามปกติ
ตัวอย่างโค้ดต่อไปนี้จะเปิดใช้โหมดแอมเบียนท์ในกิจกรรม
Kotlin
class AmbientActivity : AppCompatActivity(), AmbientModeSupport.AmbientCallbackProvider { private lateinit var mapFragment: SupportMapFragment public override fun onCreate(savedInstanceState: Bundle?) { super.onCreate(savedInstanceState) // Set the layout. It only contains a SupportMapFragment and a DismissOverlay. setContentView(R.layout.activity_main) // Enable ambient support, so the map remains visible in simplified, low-color display // when the user is no longer actively using the app but the app is still visible on the // watch face. try { val controller = AmbientModeSupport.attach(this) Log.d(AmbientActivity::class.java.simpleName, "Is ambient enabled: " + controller.isAmbient) } catch (e: Exception) { Log.w(AmbientActivity::class.java.simpleName, "Ambient mode unavailable on this device: ${e.message}") } // Obtain the MapFragment and set the async listener to be notified when the map is ready. mapFragment = supportFragmentManager .findFragmentById(R.id.map) as SupportMapFragment } override fun getAmbientCallback(): AmbientModeSupport.AmbientCallback = object : AmbientModeSupport.AmbientCallback() { /** * Starts ambient mode on the map. * The API swaps to a non-interactive and low-color rendering of the map when the user is no * longer actively using the app. */ override fun onEnterAmbient(ambientDetails: Bundle) { super.onEnterAmbient(ambientDetails) mapFragment.onEnterAmbient(ambientDetails) } /** * Exits ambient mode on the map. * The API swaps to the normal rendering of the map when the user starts actively using the app. */ override fun onExitAmbient() { super.onExitAmbient() mapFragment.onExitAmbient() } } }
Java
public class AmbientActivity extends AppCompatActivity implements AmbientModeSupport.AmbientCallbackProvider { private SupportMapFragment mapFragment; public void onCreate(Bundle savedState) { super.onCreate(savedState); // Set the layout. It only contains a SupportMapFragment and a DismissOverlay. setContentView(R.layout.activity_main); // Enable ambient support, so the map remains visible in simplified, low-color display // when the user is no longer actively using the app but the app is still visible on the // watch face. try { AmbientModeSupport.AmbientController controller = AmbientModeSupport.attach(this); Log.d( AmbientActivity.class.getSimpleName(), "Is ambient enabled: " + controller.isAmbient()); } catch (Exception e) { Log.w( AmbientActivity.class.getSimpleName(), "Ambient mode unavailable on this device: " + e.getMessage()); } // Obtain the MapFragment and set the async listener to be notified when the map is ready. mapFragment = (SupportMapFragment) getSupportFragmentManager().findFragmentById(R.id.map); } @Override public AmbientCallback getAmbientCallback() { return new AmbientCallback() { /** * Starts ambient mode on the map. The API swaps to a non-interactive and low-color * rendering of the map when the user is no longer actively using the app. */ @Override public void onEnterAmbient(Bundle ambientDetails) { super.onEnterAmbient(ambientDetails); mapFragment.onEnterAmbient(ambientDetails); } /** * Exits ambient mode on the map. The API swaps to the normal rendering of the map when * the user starts actively using the app. */ @Override public void onExitAmbient() { super.onExitAmbient(); mapFragment.onExitAmbient(); } }; } }
คุณอัปเดตหน้าจอได้ขณะที่แอปอยู่ในโหมดแอมเบียนท์ ดูรายละเอียดเพิ่มเติมเกี่ยวกับการอัปเดตเนื้อหาและเกี่ยวกับโหมดแอมเบียนท์โดยทั่วไปได้ที่ชั้นเรียนการฝึกอบรม Android เรื่องการทำให้แอปยังคงแสดงอยู่
การใช้ Street View ใน Wear OS
Street View รองรับการใช้งานบนอุปกรณ์ที่สวมใส่ได้อย่างเต็มรูปแบบ
หากต้องการอนุญาตให้ผู้ใช้ออกจากแอปเมื่อดูพาโนรามาใน Street View ให้ใช้อินเทอร์เฟซ StreetViewPanorama.OnStreetViewPanoramaLongClickListener เพื่อฟังท่าทางการคลิกค้างไว้ เมื่อผู้ใช้คลิกค้างที่ใดที่หนึ่งในภาพ Street View คุณจะได้รับเหตุการณ์ onStreetViewPanoramaLongClick(StreetViewPanoramaOrientation) เรียกใช้ DismissOverlayView.show() เพื่อแสดงปุ่มออก
โค้ดตัวอย่าง
แอปตัวอย่างมีให้บริการใน GitHub ซึ่งคุณสามารถใช้เป็นจุดเริ่มต้นสำหรับแอปของคุณได้ ตัวอย่างจะแสดงวิธีตั้งค่า Google Maps พื้นฐานใน Wear OS
ฟังก์ชันการทำงานที่รองรับใน Maps API บน Wear OS
ส่วนนี้จะอธิบายความแตกต่างของฟังก์ชันการทำงานที่รองรับสำหรับแผนที่ในอุปกรณ์ที่สวมใส่ได้เมื่อเทียบกับอุปกรณ์พกพา (โทรศัพท์และแท็บเล็ต) ฟีเจอร์ API ทั้งหมดที่ไม่ได้กล่าวถึงด้านล่างควรทำงานตามที่ระบุไว้ในเอกสารประกอบสำหรับ API แบบเต็ม
| ฟังก์ชันการทำงาน | |
|---|---|
| โหมดอินเทอร์แอกทีฟเต็มรูปแบบและโหมด Lite | คุณสามารถใช้ Maps SDK สำหรับ Android ในโหมดอินเทอร์แอกทีฟเต็มรูปแบบหรือในโหมด Lite พิจารณาใช้โหมด Lite หากต้องการเพิ่มประสิทธิภาพในอุปกรณ์ที่สวมใส่ได้ และแอปของคุณไม่จำเป็นต้องรองรับการโต้ตอบ เช่น ท่าทางสัมผัส หรือการเลื่อนและซูมแผนที่ ในโหมด Lite ระบบจะปิดใช้ Intent ในการเริ่มแอป Google Maps บนมือถือเมื่อผู้ใช้แตะแผนที่ และจะเปิดใช้บนอุปกรณ์ที่สวมใส่ได้ไม่ได้ ดูรายการความแตกต่างทั้งหมดระหว่างโหมด Lite กับโหมดอินเทอร์แอกทีฟเต็มรูปแบบได้ในเอกสารประกอบเกี่ยวกับโหมด Lite |
| แถบเครื่องมือแผนที่ | แถบเครื่องมือแผนที่จะปิดใช้และเปิดใช้ในอุปกรณ์ที่สวมใส่ไม่ได้ |
| ตัวควบคุม UI | ตัวควบคุม UI จะปิดใช้โดยค่าเริ่มต้นในอุปกรณ์ที่สวมใส่ได้ ซึ่งรวมถึงการควบคุมการซูม เข็มทิศ และตำแหน่งของฉัน คุณเปิดใช้ได้โดยใช้คลาส UiSettings ตามปกติ
|
| ท่าทางสัมผัส | ท่าทางสัมผัสแบบแตะครั้งเดียวจะทำงานตามที่คาดไว้ ตัวอย่างเช่น แตะและลากเพื่อเลื่อนแผนที่ แตะสองครั้งเพื่อซูมเข้า และแตะด้วย 2 นิ้วเพื่อซูมออก การรองรับท่าทางสัมผัสแบบมัลติทัชจะแตกต่างกันไปตามอุปกรณ์ของผู้ใช้ ตัวอย่างของท่าทางสัมผัสแบบมัลติทัช ได้แก่ การใช้ 2 นิ้วกดเพื่อเอียงแผนที่ การบีบเพื่อซูม และการหมุนด้วย 2 นิ้ว |
| แผนที่ในอาคารและอาคาร |
แผนที่ในอาคารจะปิดใช้โดยค่าเริ่มต้นในอุปกรณ์ที่สวมใส่ได้ คุณเปิดใช้ได้โดยเรียกใช้ GoogleMap.setIndoorEnabled(true) หากเปิดใช้แผนที่ในอาคาร แผนที่จะแสดงระดับชั้นเริ่มต้น
อุปกรณ์ที่สวมใส่ได้ไม่รองรับองค์ประกอบ UI ของเครื่องมือเลือก
ระดับ |
| การวางซ้อนของชิ้นส่วนแผนที่ | อุปกรณ์ที่สวมใส่ได้ไม่รองรับการวางซ้อนไทล์ |
แนวทางปฏิบัติแนะนำสำหรับการพัฒนาด้วย Maps API บน Wear OS
วิธีมอบประสบการณ์ที่ดีที่สุดแก่ผู้ใช้ในแอป
- แผนที่ควรใช้พื้นที่ส่วนใหญ่ของหน้าจอ ซึ่งจำเป็นต่อการเพิ่มประสิทธิภาพความสามารถในการใช้งานแผนที่ในอุปกรณ์สวมใส่ที่มีรูปแบบขนาดเล็ก
- เมื่อออกแบบประสบการณ์ของผู้ใช้แอป ให้คำนึงถึงข้อเท็จจริงที่ว่าอุปกรณ์ที่สวมใส่ได้มีพลังงานแบตเตอรี่ต่ำ การเปิดหน้าจอไว้ตลอดเวลาและแสดงแผนที่จะส่งผลต่อประสิทธิภาพของแบตเตอรี่