如何从 adb shell 运行 Android 相机应用程序?
如何从 adb shell 运行 Android 相机程序?
我知道我应该使用 am 但我不知道我应该输入什么命令
我使用了这个:
am start -a android.intent.action.MAIN -n com.android.camera
但它不起作用!
How can I run android camera program from adb shell?
I know that I should use am but I do not know what command should I exactly enter
I used this:
am start -a android.intent.action.MAIN -n com.android.camera
But it didn't work!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(5)
或者,您可以通过其他 2 种方式启动相机
adb shell "am start -a android.media.action.IMAGE_CAPTURE"
adb shell "am start - a android.media.action.VIDEO_CAPTURE"
其他信息
adb shell "input keyevent KEYCODE_FOCUS"
adb shell "input keyevent KEYCODE_CAMERA"
其他注意事项
如果键码字符串如 KEYCODE_CAMERA 不起作用,请从 API 描述中查找常量值。示例: KEYCODE_CAMERA
Alternatively, you can start the camera in 2 other ways
adb shell "am start -a android.media.action.IMAGE_CAPTURE"
adb shell "am start -a android.media.action.VIDEO_CAPTURE"
Other information
adb shell "input keyevent KEYCODE_FOCUS"
adb shell "input keyevent KEYCODE_CAMERA"
Other notes
f the keycode string e.g KEYCODE_CAMERA, does not work, lookup the constant value from the API description. Example: KEYCODE_CAMERA
我想补充一下 Keo Malope 的答案,虽然 IMAGE_CAPTURE 和 < a href="https://developer.android.com/reference/android/provider/MediaStore#ACTION_VIDEO_CAPTURE" rel="noreferrer">VIDEO_CAPTURE 很可能为了在大多数设备上工作,我遇到过它们无法按预期工作的情况。在这种情况下,我们还有两个常量可以尝试:
adb shell am start -a android.media.action.STILL_IMAGE_CAMERA
adb shell am start -a android.media.action.VIDEO_CAMERA
I'd like to add to Keo Malope's answer that while IMAGE_CAPTURE and VIDEO_CAPTURE are likely to work on most devices, I have encountered cases where they don't work as expected. In this case, we have two more constants that we can try:
adb shell am start -a android.media.action.STILL_IMAGE_CAMERA
adb shell am start -a android.media.action.VIDEO_CAMERA
AndroidManifest.xml
文件中。然后使用以下命令:
我希望这能解决您的问题。
CameraActivity
class.AndroidManifest.xml
file.Then use following command:
I hope this will solve your problem.
您需要指定确切的组件名称(活动名称)。
它正在我的设备(HTC Desire HD)上运行,但我不能保证它在任何地方都能工作。
You need to specify exact component name (name of activity).
It is working on my device (HTC Desire HD), but I can't guarantee that it'll work everywhere.
这对我有用
it works for me here