PDA

View Full Version : Show user current location on google map in android



hasti
25th September 2014, 08:36
In my application i want to find user current location (coordinate) and show that on google map. I've tried to show user location on google map with QWebView,it works only on windows platform, but My application will run on android.How can i show user location on map on android platform?

ChrisW67
25th September 2014, 22:19
You have not described how you have tried to do it. You have not shown even a snippet of the code that "works only on Windows." You have not described what it does differently on Android. You have not told what versions of components are involved. You have not described what you have done to diagnose the problem. How would you like us to help?

hasti
27th September 2014, 10:39
I want to implement an android application with qt 5.3 that can find user current location and show the location on a map. I've finded user location with this codes:

source = QGeoPositionInfoSource::createDefaultSource(this);
if (source){
qDebug() << "sourceName():" << source->sourceName();

source->setPreferredPositioningMethods(QGeoPositionInfoSou rce::AllPositioningMethods);

connect(source, SIGNAL(positionUpdated(QGeoPositionInfo)),
this, SLOT(positionUpdated(QGeoPositionInfo)));

source->setUpdateInterval(10000);
info = source->lastKnownPosition();
coordinate = info.coordinate();
latitude = QString::number(coordinate.latitude());
longitude = QString::number(coordinate.longitude());
}

Now i want to use QMapControl (http://www.medieninf.de/qmapcontrol/) or something like that to show location on a map widget. I know that QWebView is not supported in android(http://qt-project.org/forums/viewthread/43113). I'm using qt5.3 . Is it posible to use QMapControl in qt5.3 ? if yes, how?

wysota
27th September 2014, 15:51
The class you mention is not part of Qt5. However it shouldn't be very hard to implement something similar.