开发者

How to gain direct access to the hardware capabilities of mobile devices from mobile browsers

We are developing web browser application for mobile phones and I am trying to figure out a way that I can gain access to the camera and take a photo and then upload it to the internet. But so far what I was suggested is to use phonegap and create native application. Phonegap is fine but it is not what I am looking for because my client wants to design forms and these html forms somehow will be able to trigger the camera and take photo and upload it to a server. Do you think developing a native API for every platform and having access to its functions from the web browsers is possible? What your suggestion would be?

(Note: My customer only want application that can开发者_运维知识库 run on mobile web browsers no native application runs on I-Phone, windows mobile, Blackberry and Android)

Thanks a lot...


Web apps (not wrapped in native code as Kumar details) cannot access all device hardware and sensors. Location support is available on iOS and Android, but camera access is only available on Android (via JavaScript). Similarly, device motion APIs are not accessible on Android, but are on iOS.

As you can see, support is sketchy and if you are truly looking to use such features, you are better off (and in many cases, realistically looking at) writing native apps for each platform you intend to support.

HTML5 is not yet at the point where it can replace native apps. It can do some of the things that native apps can, but even then performance is suboptimal. Currently, native apps may be more difficult and time-consuming, but they are necessary.


Calling android native APIs from javascript functions of embedded WebView

Use JS to call Java code which will in-turn call the Camera API or whatever else you are looking for.


It's not going to be possible to do it on iPhone, the only known way of accessing the camera is through the Cocoa layer.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜