Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. Mobile and Embedded
  4. Android with QT 5.2 and QT Quick: How to include a google maps view?

Android with QT 5.2 and QT Quick: How to include a google maps view?

Scheduled Pinned Locked Moved Mobile and Embedded
19 Posts 8 Posters 10.4k Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • D Offline
    D Offline
    DerMas
    wrote on last edited by
    #1

    Some time ago I asked how to integrate google maps (or any kind of map) into a qt quick application. The answers were talking about using a webview (which doesnt work on android) or to wait for QT 5.2 since the QtLocation package would help. Unfortunately the QtLocation package has not been released for android :/

    But I read something about the QT Android Extras, which seem allow to use android native code. So is it now possible to use google maps in a QT Quick application, e.g. inside of a rectangle?
    If that is possible, I would really appreciate a quick code example, which places a google maps view in a rectangle.

    Thanks in advance :)

    1 Reply Last reply
    0
    • raven-worxR Offline
      raven-worxR Offline
      raven-worx
      Moderators
      wrote on last edited by
      #2

      see this "BUGREPORT":https://bugreports.qt-project.org/browse/QTBUG-35648

      --- SUPPORT REQUESTS VIA CHAT WILL BE IGNORED ---
      If you have a question please use the forum so others can benefit from the solution in the future

      1 Reply Last reply
      0
      • D Offline
        D Offline
        DerMas
        wrote on last edited by
        #3

        So this means, it is still not possible to show some kind of map (not necessary google maps) with qt on android? Or other there other workarounds for this problem than using native content?

        1 Reply Last reply
        0
        • raven-worxR Offline
          raven-worxR Offline
          raven-worx
          Moderators
          wrote on last edited by
          #4

          don't think so...

          But you could try "this":http://code.google.com/p/qt-google-maps (C++) or "this":http://code.google.com/p/qml-google-maps (QML). Haven't tried it yet though.
          Or integrate the Google Maps Image API by yourself into your application if you just need a "maps viewer".

          Edit: both links seem to be only tested under Qt4. And the QML version won't work on android. But maybe it helps you anyway.

          --- SUPPORT REQUESTS VIA CHAT WILL BE IGNORED ---
          If you have a question please use the forum so others can benefit from the solution in the future

          1 Reply Last reply
          0
          • S Offline
            S Offline
            sschuberth
            wrote on last edited by
            #5

            @DerMas, sounds to me as if you're trying to do the wrong thing here. In Android semantics, you integrate one app into another one (your one) not by embedding it into some view of yours, but by reusing some of the other app's activities as a whole. See for example this "Remixing apps with Android intents":https://developer.vodafone.com/develop-apps/android/android-intents/ article for the general concept. This approach has the advantage that the user can actually pick his / her favorite installed map app instead of the one that you hard-code into your app. That's also how apps like clever-tanken.de work. They do not (only) come with their own map to show you the near-by gas stations, but they are able to fire off an intent with an URI that specifies a location, and any installed app that is able to handle this intent URI will be offered to the user as a choice. In a sense, it works similar to Windows file associations. When the user presses the back button then, he / she will be back in your app, not in the mapping app or on the homescreen.

            1 Reply Last reply
            0
            • D Offline
              D Offline
              DerMas
              wrote on last edited by
              #6

              @sschuberth

              Thanks, this could lead to the proper solution, but there is a problem:

              With the described way of using intents, android will always launch a new activity (just like you said "reusing some of the other app's actitives as a whole"). But leaving my app's activity is not a wanted behavior.
              Interestingly your example of clever-tanken.de does it the way I want it to be. While clever-tanken.de embeds the map in a clever-tanken.de activity (and doesnt ask the user which app to use), a fired intent will not embed it (for example, when clicking an address of a contact, where the desired map application can be chosen and will open in its own activity).

              Here is a picture of clever-tanken.de. The top bar is still from clever-tanken.de, which means, we are still in a activity from clever-tanken.de with an embedded map. And that is the exact same thing I'd like to do with QtQuick :-)
              !http://i.imgur.com/ogMIftN.png(ct.de)!

              1 Reply Last reply
              0
              • S Offline
                S Offline
                sschuberth
                wrote on last edited by
                #7

                I see. I've corrected my post in that clever-tanken.de indeed comes with a built-in map. However, that map is fixed to Google Maps using the "Google Maps Android API":http://developer.android.com/google/play-services/maps.html. That's why clever-tanken.de can also fire off the mentioned intent in order to use a custom installed map app.

                As for the details about how to use Android fragments with QtQuick in order to embed Google Maps, I'm sorry I have to pass on that one.

                1 Reply Last reply
                0
                • D Offline
                  D Offline
                  DerMas
                  wrote on last edited by
                  #8

                  Ok, maybe one day qt will support the google maps android api and can be used inside a simple rectangle :)

                  Thanks for your input on that topic.

                  1 Reply Last reply
                  0
                  • S Offline
                    S Offline
                    sschuberth
                    wrote on last edited by
                    #9

                    After talking to a colleague of mine again, what you want to achieve indeed does not seem to be possible yet. He said that Qt for Android and Android Java apps are running completely separate rendering stacks, so one would need to somehow pass the OpenGL surface of the Google Maps Java app fragment to the native Qt app, and that's not trivial at all.

                    1 Reply Last reply
                    0
                    • D Offline
                      D Offline
                      DerMas
                      wrote on last edited by
                      #10

                      Ok :/

                      1 Reply Last reply
                      0
                      • D Offline
                        D Offline
                        DerMas
                        wrote on last edited by
                        #11

                        Well, it seems that this topic is currently addressed:

                        http://www.golem.de/news/kdab-qt-fuer-android-erleichtert-gl-app-entwicklung-1401-104090.html

                        (mixing opengl and non opengl qt widgets)

                        1 Reply Last reply
                        0
                        • JKSHJ Offline
                          JKSHJ Offline
                          JKSH
                          Moderators
                          wrote on last edited by
                          #12

                          If I've understood the article correctly, work is currently being done to enable use cases like yours: http://www.kdab.com/future-qt-android-looks-bright/

                          Qt Doc Search for browsers: forum.qt.io/topic/35616/web-browser-extension-for-improved-doc-searches

                          1 Reply Last reply
                          0
                          • U Offline
                            U Offline
                            uTMY
                            wrote on last edited by
                            #13

                            I too hope this gets addressed, I would say that for a large number of apps, the ability to include a basic map and/or satellite view should be considered a primary use case for a mobile device.

                            rgds

                            1 Reply Last reply
                            0
                            • M Offline
                              M Offline
                              Muhammad
                              wrote on last edited by
                              #14

                              I was wondering as there is a Google map app in every android device nowadays, can’t I just send coordinates from my app to the Google map app and lunch the Google map app with these coordinates?

                              I don't have endpoint, I just have Checkpoints.

                              1 Reply Last reply
                              0
                              • D Offline
                                D Offline
                                DonRico
                                wrote on last edited by
                                #15

                                Hi

                                As I understand we reached a dead end with this thread and we can't use Google Maps Android API to show google maps inside Qt android app.

                                Another solution to this would be to use web base google maps and the missing web view problem could be maybe resolved similar way as a Facebook login page was integrate in another thread https://qt-project.org/forums/viewthread/37317/

                                1 Reply Last reply
                                0
                                • D Offline
                                  D Offline
                                  DerMas
                                  wrote on last edited by
                                  #16

                                  But in that example a whole new Android Activity is launched, which will show the map in a new fullscreen "window". But many users want an embedded view. Otherwise you could just use QtAndroidExtras to fire an intent which loads a google maps Activity.

                                  1 Reply Last reply
                                  0
                                  • D Offline
                                    D Offline
                                    DonRico
                                    wrote on last edited by
                                    #17

                                    Hi

                                    Well it seems that qt activities are extendable which means (at least looks like that) that you can show standard android component in Qt android app.

                                    As an example see and try Qt hangman and it's in-app purchase:
                                    "Screenshot":https://www.dropbox.com/s/p0472uaq3u75pau/android_inapp.png
                                    "Source":https://github.com/eskilblomfeldt/qthangman
                                    "PlayStore":https://play.google.com/store/apps/details?id=com.digia.QtHangman

                                    I'm not sure at all that it helps us but just trying to be hopeful here. :)

                                    1 Reply Last reply
                                    0
                                    • D Offline
                                      D Offline
                                      DerMas
                                      wrote on last edited by
                                      #18

                                      The overwriting of an Activity sounds interesting and could lead to a solution, although the payment screen of hangman is still an overlay.

                                      Btw. didnt want to sound offensive with the previous, any help is of course appreciated :) Just wanted to clear requirements up ;)

                                      1 Reply Last reply
                                      0
                                      • V Offline
                                        V Offline
                                        Vincent007
                                        wrote on last edited by
                                        #19

                                        "Mæp-qt":https://openrepos.net/content/dcaliste/maep-qt may help you

                                        1 Reply Last reply
                                        0

                                        • Login

                                        • Login or register to search.
                                        • First post
                                          Last post
                                        0
                                        • Categories
                                        • Recent
                                        • Tags
                                        • Popular
                                        • Users
                                        • Groups
                                        • Search
                                        • Get Qt Extensions
                                        • Unsolved