DonRico
DonRico

Reputation: 182

Qt 5.2 or 5.3RC android app development and Google maps usage

I'm using Qt Quick (QML) for android (and hopefully iOs) app development and got stuck with google maps embeding. I believe the easiest and most reasonable way to do that is to use WebView component. That is working fine on Windows but when coming to android the situation seems a bit confusing. As I understand it's not possible to use WebView in android application at the moment due to fact that WebKit / WebKit Widgets are not supported in android. Also I can see that the plan is to start supporting WebEngine module that should do the trick. So my question would be, is there a way to embed google maps on android app at all at the moment or I'm in dead end?

Another wild idea is if Qt JNI calls can maybe help me out here?

Or anyother ways to achive similar result?

Thanks!

Upvotes: 1

Views: 1033

Answers (1)

Nejat
Nejat

Reputation: 32645

ِYou can use QDesktopServices to open a google map url :

QString link = "http://maps.google.com/maps?&daddr="+location;
QDesktopServices::openUrl(link);

Or use the Qt Android Extras module to launch a Google Map Intent :

String uri = "http://maps.google.com/maps?&daddr="+location;
Intent intent = new Intent(Intent.ACTION_VIEW, Uri.parse(uri));
intent.setClassName("com.google.android.apps.maps", "com.google.android.maps.MapsActivity");
if (intent.resolveActivity(m_context.getPackageManager()) != null) {
   m_context.startActivity(intent);
}

Upvotes: 2

Related Questions