maemo.org - Talk

maemo.org - Talk (https://talk.maemo.org/index.php)
-   Development (https://talk.maemo.org/forumdisplay.php?f=13)
-   -   [Help needed] HTML5 app with geolocation? (https://talk.maemo.org/showthread.php?t=84707)

taixzo 2012-06-05 19:39

[Help needed] HTML5 app with geolocation?
 
I have been working on a bus tracker app for Philadelphia, and I wrote it as a web app to ease porting to iOS/Android/etc. I figured I could make it into a native app using a QtWebView, but when I try to build it Javascript tells me that there is no navigator.geolocation object. According to the docs there should be, but I can't find a simple example of how to make it work anywhere on the web (I'm rather new to QT, so the one app that I found I couldn't figure out which parts were the functional bits I needed).

Could anyone give me some advice here?

rainisto 2012-06-05 21:43

Re: [Help needed] HTML5 app with geolocation?
 
http://stackoverflow.com/questions/9...l5-geolocation

Only supported from 4.8 onwards. So In Harmattan which uses 4.7.4 its not supported.

qwazix 2012-06-05 22:09

Re: [Help needed] HTML5 app with geolocation?
 
Theoretically using
Code:

bool WebView::evaluateJavaScript ( string scriptSource )
you can pass QML variables to the webview element, so you can use a QML PositionSource element to find the location and pass it as a variable to the web view

taixzo 2012-06-06 12:56

Re: [Help needed] HTML5 app with geolocation?
 
Quote:

Originally Posted by qwazix (Post 1218144)
Theoretically using
Code:

bool WebView::evaluateJavaScript ( string scriptSource )
you can pass QML variables to the webview element, so you can use a QML PositionSource element to find the location and pass it as a variable to the web view

Ok, so I would need to just pass in JavaScript that redefines navigator.geolocation.getCurrentPosition to call with the current lat/lon. How do I set up a PositionSource element? Is there a good source for tutorials on things like this? (Again, I'm rather new to QT.)

qwazix 2012-06-06 15:45

Re: [Help needed] HTML5 app with geolocation?
 
I don't know of a good tutorial but you can start here

http://doc.qt.nokia.com/qtmobility/q...ionsource.html

and check oobProfile source for a working example

https://github.com/qwazix/oobProfile...inPage.qml#L88


All times are GMT. The time now is 09:05.

vBulletin® Version 3.8.8