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. How to use android location manager for extensions?
Forum Updated to NodeBB v4.3 + New Features

How to use android location manager for extensions?

Scheduled Pinned Locked Moved Solved Mobile and Embedded
androidlocation
3 Posts 2 Posters 893 Views 2 Watching
  • 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.
  • K Offline
    K Offline
    koahnig
    wrote on 29 Jan 2019, 15:48 last edited by
    #1

    As being a noop in java I am struggling in understanding the use of Android's LocationManager and how it is working.

    In order to understand how this donw I used QtPositioning as basis. The java is not an activity and therefore the standard manifest part is not working. The complaint is that QtPositioning resp the renamed versioncannot be cast to an activity.

    Basically you can neglect the AndroidManifest.xml and the routines are called. Unfortunately a pointer is left as a null. The reason is that the initialzation through :

        static public void setContext(Context context)
        {
            try {
                locationManager = (LocationManager)context.getSystemService(Context.LOCATION_SERVICE);
            } catch(Exception e) {
                e.printStackTrace();
            }
        }
    

    is missing.

    Theoretically the routine could be called by QAndroidJniObject::callStaticMethod<void>. However, it is not clear to me which and where to find the required context as parameter.

    Can anybody shed some light on this?
    Are there other alternatives?

    Vote the answer(s) that helped you to solve your issue(s)

    R 1 Reply Last reply 29 Jan 2019, 15:57
    0
    • K koahnig
      29 Jan 2019, 15:48

      As being a noop in java I am struggling in understanding the use of Android's LocationManager and how it is working.

      In order to understand how this donw I used QtPositioning as basis. The java is not an activity and therefore the standard manifest part is not working. The complaint is that QtPositioning resp the renamed versioncannot be cast to an activity.

      Basically you can neglect the AndroidManifest.xml and the routines are called. Unfortunately a pointer is left as a null. The reason is that the initialzation through :

          static public void setContext(Context context)
          {
              try {
                  locationManager = (LocationManager)context.getSystemService(Context.LOCATION_SERVICE);
              } catch(Exception e) {
                  e.printStackTrace();
              }
          }
      

      is missing.

      Theoretically the routine could be called by QAndroidJniObject::callStaticMethod<void>. However, it is not clear to me which and where to find the required context as parameter.

      Can anybody shed some light on this?
      Are there other alternatives?

      R Offline
      R Offline
      raven-worx
      Moderators
      wrote on 29 Jan 2019, 15:57 last edited by raven-worx
      #2

      @koahnig said in How to use android location manager for extensions?:

      However, it is not clear to me which and where to find the required context as parameter.

      the context is most probably either the activity or the service you are running in
      see QtAndroid::androidContext()

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

      K 1 Reply Last reply 29 Jan 2019, 16:46
      3
      • R raven-worx
        29 Jan 2019, 15:57

        @koahnig said in How to use android location manager for extensions?:

        However, it is not clear to me which and where to find the required context as parameter.

        the context is most probably either the activity or the service you are running in
        see QtAndroid::androidContext()

        K Offline
        K Offline
        koahnig
        wrote on 29 Jan 2019, 16:46 last edited by
        #3

        @raven-worx

        OK, thanks. That seems to work.

        Vote the answer(s) that helped you to solve your issue(s)

        1 Reply Last reply
        0

        1/3

        29 Jan 2019, 15:48

        • Login

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