如何创建一个自动上传图片的Andr​​oid应用程序? [英] How to create an auto-upload Android picture app?

查看:111
本文介绍了如何创建一个自动上传图片的Andr​​oid应用程序?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想创建一个应用程序,自动上传图片到我的服务器。这个想法是,用户创建与天然/正常相机拍摄照片和我的应用程序得到的通知(捕获的事件),并上载图像(在背景中)。

I am trying to create an app that automatically uploads a picture to my server. The idea is that a user creates a picture with the native/normal camera and my app gets a notification (catches the event) and uploads the picture (in the background).

我发现Windows Phone的一个解决方案(的看到这里),而不是机器人。我怎样才能做到这一点? - 这是技术上的,甚至可能(与给定的API),或者是一个特殊的功能,只为承包服务( Facebook或Dropbox的做到这一点)?

I found a solution for Windows Phone (see here), but not for Android. How can I do this? - Is this technically even possible (with the given APIs) or is it a special feature just for contracted services (Facebook or Dropbox do that)?

感谢您!

推荐答案

现在,我不相信有是解雇一个摄像头捕捉事件的其他活动可以收听广播。

Right now i don't believe there is a Broadcast that is fired for a camera capture event that other activities can listen to.

但在这里你可以做什么。 声明的意图过滤器android.intent.action.CAMERA_BUTTON,并为其提供最高优先级 - 999

But here's what you can do. Declare an intent filter for "android.intent.action.CAMERA_BUTTON" and provide it the highest priority - 999

这会给你的机摄像头发射的广播的句柄。然而,这会在本机应用程序窃取播出。所以,你可能要处理自己保存文件,或制定一个黑客回馈控制本机应用程序。

This will give you a handle on the broadcast fired by the native camera. However this would steal the broadcast from the native app. So you might have to handle saving the file yourself, or formulate a hack to give back control to the native app.

不知道是否有更好的办法。也不能说太多关于用例第三方摄像头。

Don't know if there is a better way. Also can't say much about the use-case of third-party cameras.

编辑:

在进一步的检查,还有一个更好的方法。听 android.media.action.IMAGE_CAPTURE 会产生更好的结果,并应符合右转入您的要求。

On further inspection, there is a better way. Listening to android.media.action.IMAGE_CAPTURE would yield better results and should fit right into your requirements.

这篇关于如何创建一个自动上传图片的Andr​​oid应用程序?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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