如何让我的自定义相机应用默认的? [英] How do I make my custom camera app the default one?
问题描述
如果我会用下面的code:
意图takePictureIntent =新意图(MediaStore.ACTION_IMAGE_CAPTURE);
startActivityForResult(takePictureIntent,1);
这将启动默认的Android相机应用正确的......我写了一个自定义的相机应用,但如何让Android的知道,这是一个摄像头应用程序,以及用户应给予选择要使用的摄像头应用程序
在换句话说,如果我用code以上的我的的应用程序应该开始,而不是默认的Android之一。
但是,如何让Android的知道,这是一个摄像头应用程序,以及用户应给予选择要使用的摄像头应用程序。
块引用>有一个
<意向滤光器>
上的<活性GT;
该操作:<意向滤光器>
<作用机器人:名字=android.media.action.IMAGE_CAPTURE/>
<类机器人:名字=android.intent.category.DEFAULT/>
&所述; /意图滤光器>这是有人执行上述
startActivityForResult()
打电话给你的下一次,你就会出现在选配旁边其他任何支持意图
结构。If I would use the following code:
Intent takePictureIntent = new Intent(MediaStore.ACTION_IMAGE_CAPTURE); startActivityForResult(takePictureIntent,1);
it would start the default Android camera app right... I've written a custom camera app, but how do let Android know that it's a camera app, and that the user should be given the choice which Camera app to use.
In other words, if I used the code above, my app should start, and not the default android one.
解决方案but how do let Android know that it's a camera app, and that the user should be given the chose which Camera app to use.
Have an
<intent-filter>
on an<activity>
for that action:<intent-filter> <action android:name="android.media.action.IMAGE_CAPTURE" /> <category android:name="android.intent.category.DEFAULT" /> </intent-filter>
The next time that somebody executes your above
startActivityForResult()
call, you will appear in the chooser alongside anything else that supports thatIntent
structure.这篇关于如何让我的自定义相机应用默认的?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!