Android的:如何听摄像头捕获的BroadcastReceiver [英] Android: How to listen to camera capture in Broadcastreceiver

查看:478
本文介绍了Android的:如何听摄像头捕获的BroadcastReceiver的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我看到计算器就怎么听相机事件的许多职位,并得到了一些信息,但还是有一些问题,留在我的脑海里,请让我知道了答案,这些:

I saw many posts in StackOverflow regarding how to listen to camera events, and got few information but still there are few questions remain in my mind please let me know the answers for these:

我有其中有一个广播接收器,我的广播接收器将劳克我的活动应用程序,但具有广播接收器的主要目的是听取相机照片/视频拍摄意图。

I have an application which have a broadcast receiver and my broadcast receiver will lauch my activity, but the main purpose of having broadcast receiver is to listen to camera photo/video capture intent.

我想知道这是意图我必须听这一点,是有可能做这样的。

I want to know which is the intent i have to listen for this, and is it possible to do in this way.

感谢

推荐答案

有关接收摄像头照片拍摄的意图,尝试以下code

For Receiving camera photo capture intent, try following code

public class CameraEventReciver extends BroadcastReceiver {

@Override
public void onReceive(Context context, Intent intent) {

       Toast.makeText(context, "New Photo Clicked", Toast.LENGTH_LONG).show();

    } 

和清单中,注册接收器: -

and in manifest, register the receiver:-

<uses-permission android:name="android.permission.CAMERA" />

   <receiver
        android:name="com.android.application.CameraEventReciver"
        android:enabled="true" >
        <intent-filter>
            <action android:name="com.android.camera.NEW_PICTURE" />
            <data android:mimeType="image/*" />
        </intent-filter>
    </receiver>

这篇关于Android的:如何听摄像头捕获的BroadcastReceiver的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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