1. #1
    Sencha User kostysh's Avatar
    Join Date
    Nov 2011
    Location
    Odessa, Ukraine
    Posts
    175
    Vote Rating
    19
    kostysh will become famous soon enough kostysh will become famous soon enough

      0  

    Default Geolocation permission request fires twice on native builds fo iOS

    Geolocation permission request fires twice on native builds fo iOS


    Hi,

    in my app I use Ext.Map component, so at the first start of app on IPhone user will get a request for using location permissions. As expected this question should be asked a single time only, but it happened twice.
    The first time question is "App would like to use your current location"..
    and the second time something like "/var/mobile/Applications/246JF70D-4BB7-736G-870D0VHE1T/app.app/app/index.html would like to use your location"

    What happened? Why this occurs?

  2. #2
    Sencha - Senior Forum Manager mitchellsimoens's Avatar
    Join Date
    Mar 2007
    Location
    Gainesville, FL
    Posts
    37,525
    Vote Rating
    872
    mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute

      0  

    Default


    When packaged, what are you using to get the location?
    Mitchell Simoens @SenchaMitch
    Sencha Inc, Senior Forum Manager
    ________________
    Check out my GitHub, lots of nice things for Ext JS 4 and Sencha Touch 2
    https://github.com/mitchellsimoens

    Think my support is good? Get more personalized support via a support subscription. https://www.sencha.com/store/

    Need more help with your app? Hire Sencha Services services@sencha.com

    Want to learn Sencha Touch 2? Check out Sencha Touch in Action that is in print!

    When posting code, please use BBCode's CODE tags.

  3. #3
    Sencha User kostysh's Avatar
    Join Date
    Nov 2011
    Location
    Odessa, Ukraine
    Posts
    175
    Vote Rating
    19
    kostysh will become famous soon enough kostysh will become famous soon enough

      0  

    Default


    as I know, Ext.Map uses Ext.util.Geolocation

  4. #4
    Sencha User
    Join Date
    May 2012
    Posts
    14
    Vote Rating
    0
    semajhere is on a distinguished road

      0  

    Default


    Have you already find the solution on this? I have the same problem.

  5. #5
    Sencha User kostysh's Avatar
    Join Date
    Nov 2011
    Location
    Odessa, Ukraine
    Posts
    175
    Vote Rating
    19
    kostysh will become famous soon enough kostysh will become famous soon enough

      0  

    Default


    Yes. You should initialize geolocation services after application DOM is created, for example you can initialize gelocation on "painted" event on Ext.Viewport.

    If you use Ext.Map component (uses Ext.util.Geolocation) you should initialize this component with useCurrentLocation config option - false. Important!
    Also you should listen for painted event on Ext.Viewport, when this event fires - you can enable geolocation service on Ext.Map by setting mpObj.setUseCurrentLocation(true);

  6. #6
    Sencha User
    Join Date
    May 2012
    Posts
    14
    Vote Rating
    0
    semajhere is on a distinguished road

      0  

    Default


    Actually I just fixed mine by using Ext.device.Geolocation.getCurrentPosition()

  7. #7
    Sencha User
    Join Date
    Aug 2013
    Posts
    9
    Vote Rating
    0
    rsanchez01 is on a distinguished road

      0  

    Default


    Hi kostysh,

    I'm building a native ios app, and I obtain the double location permission request when using "navigator.geolocation.getCurrentPosition".
    I've tried what you said and put the call inside the "painted" listener on my Panel... but unfortunately I still obtain the double permission request. I use the geolocation to send a GET Request along with coordinates to a server that returns a json with information that I use to fill a list.

    Any idea about how to avoid this annoying prompt? I've read something about "deviceready" and phonegap, but I don't use phonegap...

    I can't use Ext.device.Geolocation.getCurrentPosition because fails when it's used on natives apps on IOS.

    Thank you very much.

  8. #8
    Sencha User
    Join Date
    Jul 2013
    Posts
    7
    Vote Rating
    0
    moakus is on a distinguished road

      0  

    Default


    Is this unfixable?

  9. #9
    Touch Premium Member
    Join Date
    Apr 2007
    Posts
    118
    Vote Rating
    -4
    hbeing123 can only hope to improve

      0  

    Default


    I am also having this problem, there doesn't seem to be any way to have the location services request fire just once... really frustrating.

  10. #10
    Touch Premium Member
    Join Date
    Apr 2007
    Posts
    118
    Vote Rating
    -4
    hbeing123 can only hope to improve

      0  

    Default


    I think I just fixed my problem on iOs at least, I had to include the GeoLocation plugin from Cordova into my build... I think what happens is that the HTML5 device gets found if the plugin doesn't override it... you can read about it on the plugin page:

    http://docs.phonegap.com/en/3.0.0/co...ne%0AInterface

    and there were helpful notes on another thread:

    http://www.sencha.com/forum/showthre...ins-with-build