開發人員專用的 Android 7.1
透過集合功能整理內容
你可以依據偏好儲存及分類內容。
Android 7.1 更新為使用者和開發人員帶來多項新功能和能力。這份文件會說明開發人員的最新消息。
應用程式捷徑
您可以使用新的捷徑功能,讓使用者從啟動器直接前往應用程式中的關鍵動作。使用者只要長按應用程式的啟動器圖示,即可顯示應用程式的捷徑,然後輕觸捷徑即可跳至相關動作。這些捷徑是吸引使用者的絕佳方式,即使使用者尚未啟動應用程式,您也能透過這些捷徑顯示應用程式的功能。
每個捷徑都會參照一個意圖,每個意圖都會啟動特定動作或工作,您可以為任何可用於意圖的動作建立捷徑。舉例來說,您可以建立意圖來傳送新簡訊、預訂服務、播放影片、繼續遊戲、載入地圖位置等等。
您可以為應用程式建立靜態捷徑,方法是將捷徑新增至 APK 中的資源檔案,也可以在執行階段動態新增捷徑。靜態捷徑非常適合用於常見動作,而動態捷徑則可讓您根據使用者的偏好設定、行為、位置等,突顯特定動作。您可以在每個應用程式中提供最多五個捷徑。不過請注意,部分啟動器應用程式不會顯示您為應用程式註冊的所有捷徑。
應用程式新增捷徑後,這些捷徑就會在任何支援捷徑的啟動器上顯示,例如 Pixel 啟動器 (Pixel 裝置的預設啟動器)、Now 啟動器 (Nexus 裝置的預設啟動器),以及其他支援捷徑的啟動器。
任何應用程式都可以建立捷徑,任何啟動器應用程式都可以新增捷徑支援功能。Android 7.1 提供 API,讓應用程式註冊捷徑,並讓啟動器讀取已註冊的捷徑。詳情請參閱 應用程式捷徑開發人員說明文件。
圖片鍵盤支援:讓使用者直接透過鍵盤輸入圖片和其他內容。
應用程式捷徑:顯示重要動作,並引導使用者立即深入瞭解應用程式。
圖片鍵盤支援
使用者往往會想使用表情符號、貼圖和其他種類的多媒體內容溝通。在舊版 Android 中,螢幕鍵盤 (又稱為輸入法編輯器或 IME) 只能傳送萬國碼 (Unicode) 表情符號至應用程式。如果是多媒體內容,應用程式必須建構無法在其他應用程式中使用的應用程式專屬表情符號,或是使用其他解決方案,例如透過簡易分享動作或剪貼簿傳送圖片。
在 Android 7.1 中,Android SDK 包含 Commit Content API,這個 API 可讓 IME 以一個通用的方式,將圖片或其他多媒體內容直接傳送至應用程式中的文字編輯器。從修訂版本 25.0.0 起,v13 支援資料庫也提供這個 API。
您可以透過這個 API,建構可從任何鍵盤接受多媒體內容的訊息應用程式,以及可傳送多媒體內容至任何應用程式的鍵盤。詳情請參閱圖片鍵盤支援開發人員說明文件。
新的專業表情符號
在 Android 7.1 中,我們新增了更多表情符號,代表更多女性和男性從事的職業。新的表情符號可讓現有的男女表情符號達到平衡,且可提供各種膚色。
如果您是鍵盤或訊息應用程式開發人員,應開始將這些表情符號納入應用程式。您可以呼叫 Paint.hasGlyph()
,動態檢查新的表情符號字元。
您現在可以為任何顯示桌布預覽畫面的元件 (例如桌布挑選器應用程式),提供動態桌布的中繼資料。您可以顯示標籤、說明和作者等現有中繼資料屬性,以及提供背景資訊網址和標題的新屬性,以便將使用者連結至桌布的更多資訊。
詳情請參閱
Android 開發人員網誌。
圓形圖示資源
您可以使用圖片素材資源工具快速建立圓形圖示素材資源。
應用程式現在可以定義圓形啟動器圖示,並在支援的裝置上使用這些圖示。當啟動器要求應用程式圖示時,架構會根據裝置版本設定,傳回 android:icon
或 android:roundIcon
。因此,應用程式在回應啟動器意圖時,應確保同時定義 android:icon
和 android:roundIcon
資源。您可以使用 Image Asset Studio 設計圓形圖示。
請務必在支援新圓形圖示的裝置上測試應用程式,瞭解圓形應用程式圖示的外觀和顯示方式。測試資源的方法之一,是執行 Android 模擬器,並使用以 API 級別 25 為目標的 Google API Emulator System。您也可以在 Google Pixel 裝置上安裝應用程式,測試圖示。
如要進一步瞭解如何設計應用程式啟動器圖示,請參閱 Material Design 設計指南。
儲存空間管理工具意圖
應用程式現在可以觸發 ACTION_MANAGE_STORAGE
意圖,將使用者帶往系統的「釋出空間」畫面。舉例來說,如果應用程式所需空間大於目前可用空間,應用程式可以使用這個意圖,讓使用者刪除不需要的應用程式和內容,釋出足夠的空間。
改善 VR 執行緒排程
Android 7.1 提供新功能,可改善 VR 執行緒排程。這點很實用,因為虛擬實境應用程式對延遲非常敏感。
應用程式現在可以將一個執行緒指定為 VR 執行緒。當應用程式處於VR 模式時,系統會更積極地排程該執行緒,以盡量縮短延遲時間。一個程序一次只能有一個 VR 執行緒,且系統可能會限制該執行緒的執行時間。如果應用程式未處於 VR 模式,這項設定就不會生效。
如要將執行緒指定為 VR 執行緒,請呼叫新的 ActivityManager.setVrThread()
方法。
示範使用者提示
應用程式現在可以檢查裝置是否以示範使用者的身分執行。
應用程式可以呼叫新的 UserManager.isDemoUser()
方法,查看應用程式是否在示範使用者沙箱中執行。這可讓應用程式為潛在客戶提供客製化的啟動體驗。舉例來說,如果以示範使用者的身分執行應用程式,應用程式可能會為使用者提供更多協助,或更詳細地說明其功能。
適用於電信業者和通話應用程式的 API
系統現在為電信業者和電話應用程式提供新的電話功能,包括:
- 多端點通話
- CDMA 語音隱私權屬性
- 視覺化語音信箱的來源類型支援
- 管理視訊通話的電信業者設定選項
適用於 Wear 裝置的新螢幕密度
Android 現已支援 Wear 裝置的多種新螢幕密度,更貼近部分裝置的實際規格。這可讓您視需要將 Wear 應用程式中的圖形微調至顯示圖形的螢幕。
新的裝置密度如下:
DENSITY_260
DENSITY_300
DENSITY_340
這個頁面中的內容和程式碼範例均受《內容授權》中的授權所規範。Java 與 OpenJDK 是 Oracle 和/或其關係企業的商標或註冊商標。
上次更新時間:2025-07-27 (世界標準時間)。
[[["容易理解","easyToUnderstand","thumb-up"],["確實解決了我的問題","solvedMyProblem","thumb-up"],["其他","otherUp","thumb-up"]],[["缺少我需要的資訊","missingTheInformationINeed","thumb-down"],["過於複雜/步驟過多","tooComplicatedTooManySteps","thumb-down"],["過時","outOfDate","thumb-down"],["翻譯問題","translationIssue","thumb-down"],["示例/程式碼問題","samplesCodeIssue","thumb-down"],["其他","otherDown","thumb-down"]],["上次更新時間:2025-07-27 (世界標準時間)。"],[],[],null,["# Android 7.1 for Developers\n\nThe Android 7.1 update introduces a variety of\nnew features and capabilities for users and developers.\nThis document highlights what's new for developers.\n\nApp Shortcuts\n-------------\n\n\nYou can use the new *shortcuts* feature to bring users from the\nlauncher directly to key actions within your app. Users simply long-press your\napp's launcher icon to reveal the app's shortcuts, then tap on a shortcut to\njump to the associated action. These shortcuts are a great way to engage\nusers, and they let you surface the functionality of your app even before\nusers launch your app.\n\n\nEach shortcut references an [intent](/guide/components/intents-filters), each of which\nlaunches a specific action or task, and you can create a shortcut for any\naction that you can express as an intent. For example, you can create intents\nfor sending a new text message, making a reservation, playing a video,\ncontinuing a game, loading a map location, and much more.\n\n\nYou can create shortcuts for your app statically by adding them to a resource\nfile in the APK, or you can add them dynamically at runtime. Static shortcuts\nare ideal for common actions, and dynamic shortcuts let you highlight actions\nbased on users' preferences, behavior, location, and so on. You can offer up\nto five shortcuts in each of your apps. Note, however, that some launcher\napps don't show every shortcut you've registered for your app.\n\n\nAfter your app adds shortcuts, they're available on any launcher that supports\nthem, such as the Pixel launcher (the default launcher on Pixel devices), the\nNow launcher (the default launcher on Nexus devices), and other launchers that\nprovide support.\n\n\nAny app can create shortcuts, and any launcher app can add support for\nshortcuts. Android 7.1 provides an API for apps to register shortcuts and\nlaunchers to read the registered shortcuts. For details, see the [App Shortcuts developer documentation](/guide/topics/ui/shortcuts). \n\n*Image keyboard support:* Lets users\ninput images and other content directly from a keyboard. \n\n\n*App shortcuts:* Surface key actions and take users deep into\nyour app instantly.\n\nImage Keyboard Support\n----------------------\n\n\nUsers often want to communicate with emojis, stickers, and other kinds of\nrich content. In previous versions of Android, soft keyboards (also known as\n[input method\neditors](/guide/topics/text/creating-input-method) or IMEs) could send only unicode emojis to apps. For rich\ncontent, apps had to either build app-specific emojis that couldn't be used\nin other apps, or use workarounds like sending images through an [Easy Share Action](/training/sharing/shareaction) or the clipboard.\n\n\nNow in Android 7.1, the Android SDK includes the Commit Content API, which\nprovides a universal way for IMEs to send images and other rich content\ndirectly to a text editor in an app. The API is also available in v13 Support\nLibrary as of revision 25.0.0.\n\n\nWith this API, you can build messaging apps that accept rich content from any\nkeyboard, as well as, keyboards that can send rich content to any app. For\ndetails, see the [Image Keyboard\nSupport developer documentation](/guide/topics/text/image-keyboard).\n\nNew Professional Emoji\n----------------------\n\n\nWith Android 7.1, we're adding new emoji that represent a wider range of\nprofessions for women as well as men. The new emoji bring parity between our\nexisting male emoji and female emoji and are available in a variety of skin\ntones.\n\n\nIf you're a keyboard or messaging app developer, you should start\nincorporating these emoji into your apps. You can dynamically check for the\nnew emoji characters by calling [Paint.hasGlyph()](/reference/android/graphics/Paint#hasGlyph(java.lang.String)).\n\nEnhanced Live Wallpaper Metadata\n--------------------------------\n\n\nYou can now provide metadata about your live wallpapers to any component\nthat's displaying a preview of the wallpaper, such as a wallpaper picker app.\nYou can show existing metadata attributes such as label, description, and\nauthor, as well as new attributes for a context URL and title to link users\nto more information about the wallpaper.\n\n\nFor more information, see the [Android Developers blog](https://android-developers.blogspot.com/2016/10/android-71-developer-preview.html).\n\nRound Icon Resources\n--------------------\n\nYou\ncan use the Image Asset tool to quickly create circular icon assets.\n\n\nApps can now define circular launcher icons, which are used on devices that\nsupport them. When a launcher requests an app icon, the framework returns\neither `android:icon` or `android:roundIcon`, depending\non the device build configuration. Because of this, apps should make sure to\ndefine both `android:icon` and `android:roundIcon`\nresources when responding to launcher intents. You\ncan use [Image Asset\nStudio](/studio/write/image-asset-studio#access) to design round icons.\n\n\nYou should make sure to test your app on devices that support the new\ncircular icons, to see how your circular app icons look and how they are\ndisplayed. One way to test your resources is to run the [Android emulator](/studio/run/emulator) and use a Google APIs\nEmulator System targeting API level 25. You can also test your icons by\ninstalling your app on a Google Pixel device.\n\n\nFor more information about designing app launcher icons, see the [Material\nDesign guidelines](https://material.google.com/style/icons.html#icons-product-icons).\n\nStorage Manager Intent\n----------------------\n\n\nApps can now fire an `ACTION_MANAGE_STORAGE` intent, taking the\nuser to the system's **Free up space** screen. For example, if\nan app requires more space than is currently available, it can use this\nintent to let the user delete unneeded apps and content to free up sufficient\nspace.\n\nImproved VR Thread Scheduling\n-----------------------------\n\n\nAndroid 7.1 provides new features to improve VR thread scheduling. This\nis useful since virtual reality apps are very latency sensitive.\n\n\nApps can now designate one thread as a VR thread. While the app is in\n[VR mode](/about/versions/nougat/android-7.0#vr), the system\nwill schedule that thread more aggressively to minimize latency. A process\nmay only have one VR thread at a time, and the system may subject that thread\nto restrictions on the amount of time it can run. The setting has no effect\nwhen the app is not in VR mode.\n\n\nTo designate a thread as a VR thread, call the new\n`ActivityManager.setVrThread()` method.\n\nDemo User Hint\n--------------\n\n\nApps can now check to see if the device is running as the demo user.\n\n\nApps can call the new `UserManager.isDemoUser()` method to see if\nthe app is running in a demo user sandbox. This allows apps to customize the\nstarting experience to a potential customer. For example, when running as a\ndemo user, an app might provide more assistance to the user, or explain its\nfeatures in more detail.\n\nAPIs for Carriers and Calling Apps\n----------------------------------\n\n\nThe system now provides new telephony features for carriers and telephone\napps, including:\n\n- Multi-endpoint calling\n- CDMA voice privacy property\n- Source type support for Visual Voicemail\n- Carrier configuration options for managing video telephony\n\nNew Screen Densities for Wear Devices\n-------------------------------------\n\n\nAndroid now supports several new screen densities for Wear devices, which\nmore closely match some devices' physical specifications. This lets you\nfine-tune the graphics in your Wear apps to the screens they'll be displayed\non, if necessary.\n\n\nThe new device densities are:\n\n- `DENSITY_260`\n- `DENSITY_300`\n- `DENSITY_340`"]]