安卓:BroadcastReceiver的意图检测相机合影留念?留念、意图、相机、BroadcastReceiver

由网友(素衣白裙)分享简介:我工作的一个Android应用程序,需要执行一个动作一个新的形象是采取与手机各一次。我不想把图像在我的应用程序,而是执行时相机应用需要的图像,并将其保存到SD卡上有所行动。现在,我已经得到了实现一个BroadcastReceiver多数民众赞成当前监听android.intent.action.CAMERA_BUTTO...

我工作的一个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.

Android之BroadcastReceiver

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.

阅读全文

相关推荐

最新文章