1

我目前正在开发一个 Phonegap Cordova 2.5 应用程序,该应用程序要求用户拍照并将其上传到我们的服务器。我使用 PhoneGap 是为了避免任何特定于 Android 的编码(可能有一天会在 iOS 上发布)。

事实证明,Android 经常(但不总是)在拍照时杀死我的应用程序,当相机模块返回照片时,我的基础应用程序从头开始恢复并且没有调用回调方法。对新拍摄照片的任何引用都会丢失,请在此处查看此帖子:

从相机拍照失败 20% 的时间

一个常见的解决方法似乎是原生 Android 代码。这引出了我的问题:如果我使用的第一个也是唯一一个 Phonegap 模块(相机)需要一些严重的黑客攻击,我为什么要使用 Phongap?我知道这甚至不是Phonegap的“错误”,而是Android生命周期设计,但仍然:我如何捍卫这种架构选择?是否已经使用 HTML、CSS 和 JS 将其全部简化为可重用的前端?我应该切换到原生 Android 吗?

4

1 回答 1

1

Answering my own question: PhoneGap is awesome in many ways, so there are numerous arguments to defend it. Most notably, the whole UI needs to be coded only once and being Javascript and CSS there are many developers who don't need to learn another language. Don't underestimate the value of "easiness", if you need to code a relatively simple app, don't bother to go native. PhoneGap will just do fine.

In my case, the app I wanted to build revolves around taking photos. So I don't use the camera in some rare use cases to spice up the user experience, but it is rather the most important part of the app. In this scenario I guess the recommended approach is to go native. That's what I did in the end.

Another approach would have been using a PhoneGap Plugin called "Foreground Camera".
PROs: Seamless photo taking in the integration. The user actually takes the picture INSIDE your app.
CONs: By default you lose ALL of the camera's capabilities (zoom, front camera, flash, etc.), so you would need to make a serious coding effort to implement some of those features manually.

于 2013-06-07T11:31:27.177 回答