Learn what Felgo offers to help your business succeed. Start your free evaluation today! Felgo for Your Business

Forums

OverviewFelgo 3 Support (Qt 5) › PositionSource on Android

Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • #24486

    Paweł

    Hello,

    in app I’m currently working on i have to display current user location on map when user clicks button. In page I created PositionSource like this

        PositionSource{
            id: positionSource
            updateInterval: 600
        }

    And in onPushed handler set positionSource.active to true and in onPopped positionSource.active to false. The problem is when I start app on android with location turned on everything works fine and I can get current position of user. However when I start application and location is turned off when I’m on mentioned page and turn on location from device settings PositionSource not detect it and still giving an error. I think it is related to PositionSource beacuse once I wrapped PostionSource in Component and load it when page is pushing onto the stack, so when I back from that page and push it again I can get current location when I turned location in device settings. Is there a way to turn device location and ‘reset’ PositionSource to work properly? Location permission was granted ofc.

    #24487

    Alex
    Felgo Team

    Hi,

    here’s what you could do:

    • If you load the page, load the PositionSource from a Component
    • Check if the property sourceError != PositionSource.NoError (in case of disabled location, this should be PositionSource.AccessError)
    • In such a case, inform the user that location is turned off and unload the PositionSource item
    • Give the user a “Retry” option that loads the PositionSource again and checks the sourceError
    • Alternatively you could also do this every x seconds using a Timer, to reload the PositionSource and check the sourceError, showing some error info as long as it is not working.

    Unfortunately it is not possible to trigger a full reset of the PositionSource item from what I know, the properties only reflect the state at initialization, which is indeed a bit inconvenient but provided like this by Qt.

    I hope that gave you an idea and could work for your app.

    Best,
    Alex

Viewing 2 posts - 1 through 2 (of 2 total)

RSS feed for this thread

You must be logged in to reply to this topic.

Qt_Technology_Partner_RGB_475 Qt_Service_Partner_RGB_475_padded