Page 1 of 2 12 LastLast
Results 1 to 10 of 12

Thread: Geolocation permission request fires twice on native builds fo iOS

  1. #1
    Sencha User kostysh's Avatar
    Join Date
    Nov 2011
    Location
    Odessa, Ukraine
    Posts
    176
    Vote Rating
    20
      0  

    Default 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 - Sr Software Engineer mitchellsimoens's Avatar
    Join Date
    Mar 2007
    Location
    Gainesville, FL
    Posts
    39,553
    Vote Rating
    1272
      0  

    Default

    When packaged, what are you using to get the location?
    Mitchell Simoens @LikelyMitch
    Sencha Inc, Senior Software Engineer
    ________________
    Learn BBCode and use it! Checkout the CODE tag!

    Check out my GitHub, lots of nice things for Ext JS and Sencha Touch
    https://github.com/mitchellsimoens

  3. #3
    Sencha User kostysh's Avatar
    Join Date
    Nov 2011
    Location
    Odessa, Ukraine
    Posts
    176
    Vote Rating
    20
      0  

    Default

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

  4. #4
    Sencha User
    Join Date
    May 2012
    Posts
    14
    Vote Rating
    0
      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
    176
    Vote Rating
    20
      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
      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
    1
      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
      0  

    Default

    Is this unfixable?

  9. #9
    Touch Premium Member
    Join Date
    Apr 2007
    Posts
    118
    Vote Rating
    -5
      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
    -5
      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

Page 1 of 2 12 LastLast

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •