Berikan izin di ponsel
Tetap teratur dengan koleksi
Simpan dan kategorikan konten berdasarkan preferensi Anda.
Saat pengguna mencoba membuka aplikasi Anda dan tidak memiliki izin yang diperlukan, gunakan Template
pesan untuk memberi tahu mereka bahwa mereka perlu memberikan izin.
Di Android Auto, jika Anda telah menggunakan metode yang dijelaskan dalam
Meminta Izin,
dialog izin akan terbuka di ponsel, selama pengguna tidak
mengemudi (untuk detail teknis, buka
Menangani input pengguna).
Dalam hal ini, sediakan toast yang mengarahkan pengguna ke ponsel. Kemudian, setelah
izin diberikan, muat ulang layar mobil agar pengguna tidak kembali ke
Template pesan.
Pertama, aplikasi meminta izin di layar mobil...
...lalu pengguna mengonfirmasi izin di ponsel saat tidak
mengemudi.
Alur contoh
Tindakan pengguna |
Tempat tindakan dilakukan |
Jumlah langkah setelah tindakan |
Pengguna membuka aplikasi. |
Di template landing (tidak ditampilkan) |
1 |
Pengguna memilih opsi untuk memberikan izin aplikasi, kemudian meninjau
toast konfirmasi. |
Pertama, gunakan Template pesan dengan dua tombol agar pengguna dapat
memberikan izin yang mereka perlukan:

Kemudian, tampilkan toast pada template Pesan yang sama untuk mengarahkan pengguna
ke ponsel mereka:

|
2 |
Pengguna memberikan izin di ponselnya.
|
Tidak ada template, karena tindakan ini terjadi di ponsel pengguna:
|
2 (tidak ada interaksi dengan aplikasi di mobil) |
Setelah pengguna memberikan izin, aplikasi akan kembali ke template
landing. |
Template landing; dalam hal ini, template Daftar Tempat (navigasi):
|
1 (jumlah langkah direset) |
Kecuali dinyatakan lain, konten di halaman ini dilisensikan berdasarkan Lisensi Creative Commons Attribution 4.0, sedangkan contoh kode dilisensikan berdasarkan Lisensi Apache 2.0. Untuk mengetahui informasi selengkapnya, lihat Kebijakan Situs Google Developers. Java adalah merek dagang terdaftar dari Oracle dan/atau afiliasinya.
Terakhir diperbarui pada 2025-07-25 UTC.
[null,null,["Terakhir diperbarui pada 2025-07-25 UTC."],[[["\u003cp\u003eWhen users lack necessary permissions, use the Message template to inform them and provide an option to grant permissions.\u003c/p\u003e\n"],["\u003cp\u003eIn Android Auto, the permission dialog opens on the user's phone when they are not driving, requiring a toast to direct them.\u003c/p\u003e\n"],["\u003cp\u003eAfter permissions are granted, refresh the car screen to transition from the Message template to the intended content, such as the landing template.\u003c/p\u003e\n"],["\u003cp\u003eThe app's flow involves requesting permissions on the car screen, user confirmation on their phone, and returning to the app's landing template.\u003c/p\u003e\n"]]],[],null,["# Grant permissions on phone\n\n\u003cbr /\u003e\n\nWhen users try to open your app and lack necessary permissions, use the Message\ntemplate to tell them they need to grant permissions.\n\nIn Android Auto, if you have used the method described in\n[Request Permissions](https://developer.android.com/training/cars/apps#permissions),\nthe permissions dialog will open on the phone, as long as the user is not\ndriving (for technical details, visit\n[Handle user input](https://developer.android.com/training/cars/apps#handle-user-input)).\nIn this case, provide a toast directing the user to the phone. Then, after\npermissions are granted, refresh the car screen so the user doesn't return to\nthe Message template. \nFirst, the app requests permissions on the car screen... \n...and then the user confirms permissions on their phone when not\ndriving.\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\nSample flow\n-----------\n\n| User action | Where action is performed | Step count after action |\n|--------------------------------------------------------------------------------------------|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|------------------------------------|\n| The user opens the app. | On your landing template (not shown) | 1 |\n| The user selects the option to grant app permissions, then reviews the confirmation toast. | First, use the Message template with two buttons to allow users the chance to grant the permissions that they need: Then, display a toast on that same Message template to direct the user to their phone: | 2 |\n| The user grants permission on their phone. | No template, as this action occurs on the user's phone: | 2 (no interaction with app in car) |\n| After the user grants permissions, the app returns to the landing template. | Landing template; in this case, the Place List (navigation) template: | 1 (step count resets) |"]]