views:

367

answers:

2

When I first ran across PhoneGap, I was excited because I envisioned simply dropping in the URL of a mobile site and simply updating the mobile site to use the devices capabilities when available.

Alas, it seems it is not that easy.

From what I understand (and I could be incorrect), any HTML/JS access to the device's hardware is limited to local 'pages'. So essentially create a HTML/JS local 'web' app to access the 'real' mobile web app by AJAX like calls. It seems a little redundant (at least to me) when the point is to simply extend the interface an existing mobile site.

Not trying to knock PhoneGap here, just wondering if there's a similar framework that allows a remote site to access the phone's hardware directly. Or if I've missed how that can be done with PhoneGap.

(Sure, I know "allows a remote site to access the phone's hardware directly" sounds scary - but the URL is hard-coded in the app, and HTTPS could provide authenticity. Of course, security is probably why this isn't supported by PhoneGap.)

A: 

I may be wrong here, but you probably are trying to access device hardware capabilities through a browser, which I dont think is currently possible. There are many workarounds for this, one of which I am particularly interested in, is the possibility of using Opera Unite through the Opera mini browser on handset. This runs a webserver through the browser, and can be customized to expose any hardware functionality we want. This frankly may not be possible but is an interesting avenue for further investigation.

omermuhammed
No, not trying to access through a 'standard' browser. PhoneGap (along with a few other projects) provide a blank 'app', which is (simplified) a web view (the phone's browser) with JS hooks to the system hardware. However, from what I can tell, the page using those JS hooks must be local. I'd like to use a remote page.
Tim Lytle
Yup! I was wrong :)
omermuhammed
+1  A: 

Phonegap do not allow such behaviour. This is a restriction to allow phonegap applications to be published in the appstore, i think. Maybe you can hack the phonegap source to allow it, it should be possibile, but then you're out of the appstore.

Marek