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 Mock locations

Android Mock locations

Scheduled Pinned Locked Moved Unsolved Mobile and Embedded
5 Posts 3 Posters 1.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.
  • G Offline
    G Offline
    Geraud
    wrote on 3 Oct 2016, 19:04 last edited by
    #1

    Hello,

    I am implementing an app that awards users with rewards based on their location, through GPS.

    The issue on Android is that users may use a mock location spoofer to get the rewards without moving.

    Is there a way in Qt to know that a location has been spoofed? when I print the name of the source on Android is... "android".

    There are/were several ways to do that on Android through the LocationManager, (I am fine with using JNI calls), however these have been deprecated in favor of a "mock location?" flag for each data point. However this would mean departing from Qt's Gps classes and using Java directly.

    Has anyone else tried to do something similar?

    Thank you.

    1 Reply Last reply
    0
    • S Offline
      S Offline
      SGaist
      Lifetime Qt Champion
      wrote on 3 Oct 2016, 20:00 last edited by
      #2

      Hi,

      This stack overflow post might what you are looking (also take a look at the comments).It's only native API but you could write a small helper library to provide a Qt API for that.

      Hope it helps

      Interested in AI ? www.idiap.ch
      Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

      G 1 Reply Last reply 3 Oct 2016, 20:54
      0
      • S SGaist
        3 Oct 2016, 20:00

        Hi,

        This stack overflow post might what you are looking (also take a look at the comments).It's only native API but you could write a small helper library to provide a Qt API for that.

        Hope it helps

        G Offline
        G Offline
        Geraud
        wrote on 3 Oct 2016, 20:54 last edited by
        #3

        @SGaist Thank you, I am actually already using this now, but it has its shortcomings (see Pokemon Go posts about how to cheat these methods :) ). I hoped there would be something more "Qt-native".

        1 Reply Last reply
        0
        • S Offline
          S Offline
          SGaist
          Lifetime Qt Champion
          wrote on 3 Oct 2016, 21:17 last edited by
          #4

          Well, Qt is using whatever the platform provides and I don't think (I may be wrong though) that this is the kind of scenario that the devs behind the module would think of. Looks like even the android dev didn't thought about having this working only when developing an application.

          Interested in AI ? www.idiap.ch
          Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

          1 Reply Last reply
          0
          • P Offline
            P Offline
            PavelIgorevich
            wrote on 4 Oct 2016, 09:50 last edited by
            #5

            qt doesn't have this funtionality u need to:

            1. check Settings.Secure.ALLOW_MOCK_LOCATION string on API Level < 23 (or 21 - don't remember)
            2. on API level >=23 u need to check isFromMockProvider on returned Location object
            1 Reply Last reply
            0

            1/5

            3 Oct 2016, 19:04

            • Login

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