Reply
Thread Tools
Posts: 958 | Thanked: 3,426 times | Joined on Apr 2012
#1
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?
 
Posts: 1,067 | Thanked: 2,383 times | Joined on Jan 2012 @ Finland
#2
http://stackoverflow.com/questions/9...l5-geolocation

Only supported from 4.8 onwards. So In Harmattan which uses 4.7.4 its not supported.
__________________
IRC: jonni@freenode
Sailfish: ¤ Qt5 SailfishTouchExample ¤ Qt5 MultiPointTouchArea Example ¤ ipaddress ¤ stoken ¤ Sailbox (Dropbox client) ¤
Harmattan: ¤ Presence VNC for Harmattan ¤ Live-F1 ¤ BTinput-terminal ¤ BabyLock ¤ BabyLock Trial ¤ QML TextTV ¤
Disclaimer: all my posts in this forum are personal trolling and I never post in any official capacity on behalf of any company.
 

The Following User Says Thank You to rainisto For This Useful Post:
qwazix's Avatar
Moderator | Posts: 2,622 | Thanked: 5,447 times | Joined on Jan 2010
#3
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
__________________
Proud coding competition 2012 winner: ρcam
My other apps: speedcrunch N9 N900 Jolla –– contactlaunch –– timenow

Nemo UX blog: Grog
My website: qwazix.com
My job: oob
 

The Following User Says Thank You to qwazix For This Useful Post:
Posts: 958 | Thanked: 3,426 times | Joined on Apr 2012
#4
Originally Posted by qwazix View Post
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's Avatar
Moderator | Posts: 2,622 | Thanked: 5,447 times | Joined on Jan 2010
#5
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
__________________
Proud coding competition 2012 winner: ρcam
My other apps: speedcrunch N9 N900 Jolla –– contactlaunch –– timenow

Nemo UX blog: Grog
My website: qwazix.com
My job: oob
 

The Following User Says Thank You to qwazix For This Useful Post:
Reply


 
Forum Jump


All times are GMT. The time now is 11:08.