Android 7.1 开发者版本
使用集合让一切井井有条
根据您的偏好保存内容并对其进行分类。
Android 7.1 更新为用户和开发者引入了各种新功能。本文重点介绍面向开发者的新功能。
应用快捷方式
您可以使用新的快捷方式功能,让用户从启动器直接进入应用中的关键操作。用户只需长按应用的启动器图标即可显示应用的快捷方式,然后点按快捷方式即可跳转到关联的操作。这些快捷方式是吸引用户的绝佳方式,可让您在用户启动应用之前展示应用的功能。
每个快捷方式都会引用一个 intent,每个 intent 都会启动特定操作或任务,并且您可以为任何可表示为 intent 的操作创建快捷方式。例如,您可以创建用于发送新短信、进行预订、播放视频、继续游戏、加载地图位置等的 intent。
您可以通过将快捷方式添加到 APK 中的资源文件来静态创建应用快捷方式,也可以在运行时动态添加快捷方式。静态快捷方式非常适合常用操作,而动态快捷方式可让您根据用户的偏好设置、行为、位置等突出显示操作。您可以在每个应用中提供最多 5 个快捷方式。不过,请注意,某些启动器应用不会显示您为应用注册的所有快捷方式。
您的应用添加快捷方式后,这些快捷方式将在支持它们的任何启动器上可用,例如 Pixel 启动器(Pixel 设备上的默认启动器)、Now 启动器(Nexus 设备上的默认启动器)以及提供支持的其他启动器。
任何应用都可以创建快捷方式,任何启动器应用都可以添加对快捷方式的支持。Android 7.1 提供了一个 API,供应用注册快捷方式,并供启动器读取已注册的快捷方式。如需了解详情,请参阅应用快捷方式开发者文档。
图片键盘支持:让用户能够直接通过键盘输入图片和其他内容。
应用快捷方式:即时呈现关键操作并让用户深入了解您的应用。
图片键盘支持
用户通常希望使用表情符号、贴纸和其他类型的富媒体内容进行通信。在之前的 Android 版本中,软键盘(也称为输入法或 IME)只能向应用发送 Unicode 表情符号。对于富媒体内容,应用必须构建不能在其他应用中使用的应用专用表情符号,或者使用通过轻松分享操作或剪贴板发送图片等解决方法。
现在,在 Android 7.1 中,Android SDK 包含 Commit Content API,它提供了一种通用方式,使 IME 可以将图片和其他富媒体内容直接发送到应用中的文本编辑器。从版本 25.0.0 开始,v13 支持库中也提供此 API。
借助此 API,您可以构建可接受来自任意键盘的富媒体内容的即时通讯应用,以及可向任何应用发送富媒体内容的键盘。如需了解详情,请参阅图片键盘支持开发者文档。
新增了专业表情符号
在 Android 7.1 中,我们添加了新的表情符号,以代表更多女性和男性职业。新表情符号在外观上与现有的男性表情符号和女性表情符号保持一致,并且有各种肤色可选。
如果您是键盘或即时通讯应用开发者,则应开始将这些表情符号纳入您的应用。您可以通过调用 Paint.hasGlyph()
动态检查是否有新的表情符号字符。
现在,您可以向显示壁纸预览的任何组件(例如壁纸选择器应用)提供有关动态壁纸的元数据。您可以显示标签、说明和作者等现有元数据属性,以及上下文网址和标题的新属性,以便将用户链接到有关壁纸的更多信息。
如需了解详情,请参阅
Android 开发者博客。
圆形图标资源
您可以使用 Image Asset 工具快速创建圆形图标资源。
现在,应用可以定义圆形启动器图标,以便在支持此类图标的设备上使用。当启动器请求应用图标时,框架会返回 android:icon
或 android:roundIcon
,具体取决于设备 build 配置。因此,应用在响应启动器 intent 时应务必同时定义 android:icon
和 android:roundIcon
资源。您可以使用 Image Asset Studio 设计圆形图标。
您应务必在支持新圆形图标的设备上测试应用,以查看圆形应用图标的外观和显示方式。测试资源的一种方法是运行 Android 模拟器,并使用以 API 级别 25 为目标平台的 Google API 模拟器系统。您还可以在 Google Pixel 设备上安装应用,以测试图标。
如需详细了解如何设计应用启动器图标,请参阅 Material Design 指南。
存储空间管理器 intent
应用现在可以触发 ACTION_MANAGE_STORAGE
intent,将用户引导至系统的释放空间屏幕。例如,如果应用所需的空间超出了当前可用空间,则可以使用此 intent 让用户删除不需要的应用和内容,以释放足够的空间。
改进了 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 和/或其关联公司的注册商标。
最后更新时间 (UTC):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"]],["最后更新时间 (UTC):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`"]]