在手機上授予權限
如果使用者嘗試開啟您的應用程式,且缺少必要權限,請使用訊息範本告知他們必須授予權限。
在 Android Auto 中,如果您已使用要求權限中所述的方法,只要使用者未開車,手機就會開啟權限對話方塊 (如需技術詳細資料,請參閱「處理使用者輸入內容」)。在此情況下,請提供浮動式訊息,將使用者導向手機。然後,在授予權限後重新整理車輛螢幕,讓使用者不會返回訊息範本。
流程範例
使用者動作 |
動作執行位置 |
動作完成後的步數 |
使用者開啟應用程式。 |
在到達網頁範本上 (不會顯示) |
1 |
使用者選取授予應用程式權限的選項,然後查看確認浮動式訊息。 |
首先,使用含有兩個按鈕的訊息範本,讓使用者有機會授予所需的權限: ![含有主要和次要動作按鈕的訊息範本](https://developers.google.cn/static/cars/design/create-apps/sample-flows/images/grant_permissions_on_phone_1.png?authuser=6&hl=zh-tw)
接著,在同一個訊息範本中顯示浮動式訊息,引導使用者前往手機:
![含有兩個按鈕和浮動式訊息的訊息範本](https://developers.google.cn/static/cars/design/create-apps/sample-flows/images/grant_permissions_on_phone_2.png?authuser=6&hl=zh-tw)
|
2 |
使用者在手機上授予權限。 |
無範本,因為這個動作會在使用者的手機上發生:
|
2 (未與車上的應用程式互動) |
使用者授予權限後,應用程式會返回到達網頁範本。 |
到達網頁範本;在本例中,地點清單 (導覽) 範本:
|
1 (步數重設) |
除非另有註明,否則本頁面中的內容是採用創用 CC 姓名標示 4.0 授權,程式碼範例則為阿帕契 2.0 授權。詳情請參閱《Google Developers 網站政策》。Java 是 Oracle 和/或其關聯企業的註冊商標。
上次更新時間:2024-07-23 (世界標準時間)。
[null,null,["上次更新時間:2024-07-23 (世界標準時間)。"],[[["When users lack necessary permissions, use the Message template to inform them and provide an option to grant permissions."],["In Android Auto, the permission dialog opens on the user's phone when they are not driving, requiring a toast to direct them."],["After permissions are granted, refresh the car screen to transition from the Message template to the intended content, such as the landing template."],["The app's flow involves requesting permissions on the car screen, user confirmation on their phone, and returning to the app's landing template."]]],[]]