Disable GPS

4 posts, 0 answers
  1. Brett
    Brett avatar
    2 posts
    Member since:
    Feb 2015

    Posted 15 Jul 2015 Link to this post

    Hi,

    Would be great to be able to disable GPS altogether so that it errors, the same way android devices do when trying to access geolocation functionality.

    Brett

     

  2. Ventsislav Georgiev
    Admin
    Ventsislav Georgiev avatar
    17 posts

    Posted 17 Jul 2015 Link to this post

    Hi Brett,

    Thank you for contacting us.

    I am not sure I understand your question. Could you please elaborate on your requirements and  in what kind of application (hybrid, native) you would like to disable the GPS. Please also provide information about which AppBuilder client you are using:
    I assume you are looking for this functionality in the Device Simulator and if that is the case I can confirm that we have it logged as a feature request. However, I cannot yet commit to a time frame when it will become available.

    Regards,
    Ventsislav Georgiev
    Telerik
     

    Visit the Telerik Verified Plugins Marketplace and get the custom Cordova plugin you need, already tweaked to work seamlessly with AppBuilder.

     
  3. Brett
    Brett avatar
    2 posts
    Member since:
    Feb 2015

    Posted 18 Jul 2015 in reply to Ventsislav Georgiev Link to this post

    Hi,

    On a physical android device you can disable GPS altogether whereas in the appbuilder simulators (on all platforms) you can only set the location, not disable the functionality. 

     I would like to simulate switching GPS on and off within the application.

    Thanks, 

    Brett

  4. Ventsislav Georgiev
    Admin
    Ventsislav Georgiev avatar
    17 posts

    Posted 21 Jul 2015 Link to this post

    Hello Brett,

    I'm afraid we don't have this functionality yet. We have it logged in as a feature request but I cannot commit to a time frame when it will become available. However you should be able to simulate disabling the GPS in the simulator by overriding the behavior of the navigator.geolocation.getCurrentPosition function.

    Add this JavaScript code to your application:
    window.disableGPS = false;
    var defaultGetCurrentPosition = navigator.geolocation.getCurrentPosition;
    navigator.geolocation.getCurrentPosition = function () {
        if(window.disableGPS && arguments.length >= 2 && typeof(arguments[1]) == 'function') {
            var positionError = new PositionError(PositionError.PERMISSION_DENIED, "The GPS has been switched off.");
            arguments[1](positionError);
        }
        else {
            defaultGetCurrentPosition.apply(navigator.geolocation, arguments);
        }
    };

    This way you could simulate GPS disabling by using the Debug-In-Simulator functionality and changing the flag in the Console pane:
    window.disableGPS = true

    If you need any further assistance don't hesitate to contact us.

    Regards,
    Ventsislav Georgiev
    Telerik
     

    Visit the Telerik Verified Plugins Marketplace and get the custom Cordova plugin you need, already tweaked to work seamlessly with AppBuilder.

     
Back to Top