安卓:BroadcastReceiver的意图检测相机合影留念? [英] Android: BroadcastReceiver intent to Detect Camera Photo Taken?

查看:114
本文介绍了安卓:BroadcastReceiver的意图检测相机合影留念?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我工作的一个Android应用程序,需要执行一个动作一个新的形象是采取与手机各一次。我不想把图像在我的应用程序,而是执行时相机应用需要的图像,并将其保存到SD卡上有所行动。现在,我已经得到了实现一个BroadcastReceiver多数民众赞成当前监听android.intent.action.CAMERA_BUTTON。然而,这似乎并没有当我想它被调用。我试图在应用程序上我自己的手机上的BroadcastReceiver的的onReceive方法的第一线断行调试,但它从来没有达到的code。

有谁知道什么是正确的意图,我应该倾听?或正在使用一个BroadcastReceiver甚至不是最好的方式做到这一点? (例如,有没有更好的方式来做到这一点,如听,当一个新的图像保存到卡)?

谢谢!

更新:我也有我的手机(HTC Eris的)一个轨迹球,所以有没有可能采取这种方式不会发送为拍照键的照片?如果是这样,是否有解决方法的电话没有拍照键,而是像一个轨迹球?

解决方案
  

现在,我已经得到了一个BroadcastReceiver实现多数民众赞成当前监听android.intent.action.CAMERA_BUTTON。然而,这似乎并没有当我想它被调用。

这是唯一被广播如果前景活动不消耗事件。

I'm working on an Android application which needs to perform an action each time a new image is taken with the phone. I don't want to take the image within my application, but rather perform some action when the Camera app takes an image and saves it to the SD card. Right now, I've gotten a BroadcastReceiver implemented that's currently listening for "android.intent.action.CAMERA_BUTTON". However, this doesn't seem to get called when I'm wanting it to. I've tried to debug the application on my own phone with a linebreak on the first line of the BroadcastReceiver's OnReceive method, but it never reaches that code.

Does anyone know what the correct intent for which I should be listening is? Or is using a BroadcastReceiver not even the best way to do this? (For example, is there a better way to accomplish this such as listening for when a new image is saved to the card)?

Thanks!

Update: I do have a Trackball on my phone (HTC Eris), so is it possible that taking photos that way doesn't get sent as "Camera Button"? If so, is there a workaround for a phone without a "Camera Button", but rather something like a Trackball?

解决方案

Right now, I've gotten a BroadcastReceiver implemented that's currently listening for "android.intent.action.CAMERA_BUTTON". However, this doesn't seem to get called when I'm wanting it to.

That only gets broadcast if the foreground activity does not consume the event.

这篇关于安卓:BroadcastReceiver的意图检测相机合影留念?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆