Success! Looks like we've fixed this one. According to our records the fix was applied for TOUCH-2919 in a recent build.
  1. #1
    Sencha User
    Join Date
    Apr 2012
    Location
    Porto Alegre, RS - Brazil
    Posts
    4
    Vote Rating
    0
    gaflach is on a distinguished road

      0  

    Default High Accuracy Geolocation Not Working due to Wrong Property Name

    High Accuracy Geolocation Not Working due to Wrong Property Name


    REQUIRED INFORMATION

    Ext version tested:
    • Sencha Touch 2.0.1
    Browser versions tested against:
    • Android 2.2
    Description:
    • Sencha Touch 2.0.1 is not allowing high accuracy geolocation via Ext.util.Geolocation class.

      According to Geolocation API Specification in order to enable high accuracy geolocation, one must set true the enableHighAccuracy property of the PositionOptions object. However taking a look at Sencha Touch sources in sdk/src/util/Geolocation.js file at line 375, the property is being named allowHighAccuracy.
    Code:
        parseOptions: function() {
            var timeout = this.getTimeout(),
                ret = {
                    maximumAge: this.getMaximumAge(),
                    allowHighAccuracy: this.getAllowHighAccuracy()
                };
    
    
            //Google doesn't like Infinity
            if (timeout !== Infinity) {
                ret.timeout = timeout;
            }
            return ret;
        },
    The result that was expected:
    • High accuracy geolocation information.
    • A GPS icon blinking at Android bar indicating that geolocation information is being retrieved.
    The result that occurs instead:
    • Low accuracy geolocation information.
    • No GPS icon blinking.
    Test Case:

    Code:
    Ext.create('Ext.util.Geolocation', {
        autoUpdate: true,
        allowHighAccuracy: true,
        listeners: {
            locationupdate: function(geo) {
                console.log(geo);
            }
        }
    });
    HELPFUL INFORMATION

    Possible fix:
    • I have solved this issue by simply renaming allowHighAccuracy to enableHighAccuracy at file sdk/src/util/Geolocation.js file at line 375.
    Operating System:
    • Ubuntu 12.04

  2. #2
    Sencha - Senior Forum Manager mitchellsimoens's Avatar
    Join Date
    Mar 2007
    Location
    Gainesville, FL
    Posts
    36,994
    Vote Rating
    846
    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


    Thanks for the report.
    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
    Ext JS Premium Member Brendan Carroll's Avatar
    Join Date
    May 2007
    Location
    Balmer, MD.
    Posts
    139
    Vote Rating
    1
    Brendan Carroll is on a distinguished road

      0  

    Default


    Any update on this issue, confirmation, fix?
    -BC ...

  4. #4
    Sencha - Senior Forum Manager mitchellsimoens's Avatar
    Join Date
    Mar 2007
    Location
    Gainesville, FL
    Posts
    36,994
    Vote Rating
    846
    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


    I have opened a bug report for it so you have confirmation
    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.

  5. #5
    Ext JS Premium Member Brendan Carroll's Avatar
    Join Date
    May 2007
    Location
    Balmer, MD.
    Posts
    139
    Vote Rating
    1
    Brendan Carroll is on a distinguished road

      0  

    Default


    Thanks Mitchell.
    -BC ...

  6. #6
    Sencha User
    Join Date
    Apr 2009
    Posts
    18
    Vote Rating
    3
    LewLadd is on a distinguished road

      0  

    Default


    Hi Guilherme,

    Thanks for your report.

    For added clarification,
    1) is it true that once you make the line change to line 375 above, your application is able to access the device's GPS?

    2) is your application running in a browser or as a packaged application?

    Thanks in advance for your reply.
    Lew.

  7. #7
    Sencha User
    Join Date
    Apr 2012
    Location
    Porto Alegre, RS - Brazil
    Posts
    4
    Vote Rating
    0
    gaflach is on a distinguished road

      0  

    Default


    Hi.

    1) Yes and then I got the GPS icon in the Android status bar indicating that the GPS is activated.

    2) Both. Directly in the Android's default browser and in a app (using PhoneGap).

    The bug seems to be just a matter of naming: according to HTML5 the property for high precision should be called enableHighAccuracy, but in the code the property was called allowHighAccuracy.

  8. #8
    Sencha User
    Join Date
    Jun 2012
    Posts
    2
    Vote Rating
    0
    senchaboy3 is on a distinguished road

      0  

    Default


    Hi all,

    Was anyone successful with reaching a working geo functionality on android without the phoneGap wrapper using sencha cmd tool only?

    Thx.
    senchaboy3.

  9. #9
    Sencha User
    Join Date
    Apr 2012
    Location
    Porto Alegre, RS - Brazil
    Posts
    4
    Vote Rating
    0
    gaflach is on a distinguished road

      0  

    Default


    Hi senchaboy3.

    Initially, I got confused with that too. But if you take a look at permissions that the Sencha-packaged app requests (sencha app build native), you will see that geolocation is not listed. So the app is not allowed to use user's geolocation. In the current version of SDK Tools, 2.0.0-Beta3, there is no documented way to change required permissions -- they are hardcoded.

    A workaround is to edit the base manifest file used by Sencha to package the app:
    C:\Windows\stbuild\st-res\android\AndroidManifest.xml

    Apart from that, geolocation will work but not using high precision (no flashing icon in Android's status bar) -- this is the bug we are talking about here. A workaround for that was posted too in the first post of this thread.

  10. #10
    Sencha User
    Join Date
    Jun 2012
    Posts
    2
    Vote Rating
    0
    senchaboy3 is on a distinguished road

      0  

    Default


    ok,

    So basically i gave up and decided to go on the safe side and use PhoneGap to reach Geolocation correctness. I am using phoneGap 1.8 and sencha 2.0.1

    I tried running the simple sencha example that accompanies the applaud eclipse plugin and i stumbled upon the following openIssue. I actually encounter the ugly

    "
    TypeError: Result of expression 'Ext.Application' [undefined] is not a constructor. at file:///android_asset/www/phonegapdemo-w-sencha.js:254
    "
    myself. this being said can someone (gaflach if you may) explain to me how this Gap with phoneGap was bridged?

    Thanks,
    struggling senchaboy3