projected-hardware
它能做什么
这个技能说明如何在 Android 应用中访问投屏智能眼镜上的摄像头和麦克风等硬件。涵盖眼镜权限和连接管理。适合开发智能眼镜功能的 Android 开发者。
适用场景
- ✓你的应用需要用已连接的智能眼镜拍照的时候。
- ✓你的应用需要访问投屏眼镜的麦克风并请求权限的时候。
- ✓眼镜连接断开时,你需要处理连接并释放资源的时候。
技能链接
https://github.com/android/skills/blob/main/xr/projected-hardware/SKILL.md复制后粘贴给你的 AI(Claude、ChatGPT 或 Cursor),让它按照说明操作。
使用方法
最简单的方法:复制下面的消息,粘贴给你的 AI。它会读取这个技能并按说明操作。
可直接粘贴的消息
适用于 Claude Code、Codex 或 Cursor:在项目文件夹中运行,即可安装该技能。
下载 SKILL.md,放进智能体的技能文件夹。
可以这样问 AI
“请帮我在 Android 应用中添加一个功能,从已连接的智能眼镜拍摄照片。”
每周 5 个新技能,1 分钟读完。
工作原理
这个技能指向投屏环境、权限和拍照的参考步骤。它说明如何检查眼镜连接,并管理与连接相关的资源。
技术内容(原始 SKILL.md)
作者在 GitHub 上的英文原文。
Prerequisites
- You must use a
compileSdkof 36 or higher.
Connection and lifecycle management
Intelligent eyewear hardware is only accessible while the glasses are connected
to the host phone. Monitor connection state and manage resource lifecycles using
ProjectedContext. You must read
Understand projected activities and projected contexts to understand
how to get a projected context and how to manage its lifecycle.
Request glasses hardware permissions
- Hardware permissions and opt-in : You must read Request hardware permissions to understand how to declare camera and microphone runtime permissions in the Android Manifest file, request runtime permissions in different scenarios, and handle permission results.
Glasses hardware access and capabilities
- Camera capture and CameraX : You must read Capture an image with the glasses' camera to understand the implementation patterns for capturing a photo with the glasses' camera using a
ProjectedContext.
常见问题
需要哪个编译 SDK?
项目必须使用 compileSdk 36 或更高版本。
眼镜断开连接时硬件还能用吗?
不能。只有在眼镜与手机连接时才能访问硬件。
如何声明权限?
摄像头和麦克风权限需要在 Android 清单文件中声明,并在运行时请求。
详情
作者的原始描述
Provides instructions and workflows for accessing and managing hardware on Android XR projected devices, such as audio glasses and display glasses. Use this skill when building experiences for intelligent eyewear in an Android app and you need to access device hardware like the camera and microphone, handle glasses-specific runtime permissions, or manage connection lifecycles using projected context.
repo: android/skills
热度
- GitHub 星标
- 10k
- 排名
- #11942
- 许可证
- Apache-2.0
- 更新时间
- 2026/10/29
评论
- …
同一仓库的更多技能
agp-9-upgrade
10k帮你的智能体把 Android 应用升级到 Android Gradle Plugin 9,并处理其中的破坏性变更。不适用于多平台项目。
camerax
10k帮你的智能体使用 CameraX 构建 Android 相机功能,包括视频录制、硬件控制以及 ML Kit 和 Media3 效果。
android-for-cars-parked-apps
10k帮你的智能体把 Android 视频、游戏或浏览器应用调整为可在 Android Auto 和 Android Automotive 上以停放应用形式运行。
appfunctions
10k帮你的智能体在 Android 应用中找到关键工作流,并把它们暴露为 AI 智能体和语音命令可以运行的 AppFunctions。