Ivan Off
Ivan Off

Reputation: 25

Location Based ARJS Example constantly shows alert('Cannot retrieve GPS position. Signal is absent.')

<!DOCTYPE html>
<html>

<head>
    <meta charset="utf-8" />
    <meta http-equiv="X-UA-Compatible" content="IE=edge" />
    <title>GeoAR.js demo</title>
    <script src="https://aframe.io/releases/1.0.4/aframe.min.js"></script>
    <script src="https://unpkg.com/[email protected]/dist/aframe-look-at-component.min.js"></script>
    <script src="https://raw.githack.com/AR-js-org/AR.js/master/aframe/build/aframe-ar-nft.js"></script>
</head>

<body style="margin: 0; overflow: hidden;">
    <a-scene vr-mode-ui="enabled: false" embedded arjs="sourceType: webcam; debugUIEnabled: false;">
        <a-text value="This content will always face you." look-at="[gps-camera]" scale="120 120 120" gps-entity-place="latitude: 42.123456; longitude: 13.230240;"></a-text>
        <a-camera gps-camera rotation-reader> </a-camera>
    </a-scene>
</body>

</html>

Checked out the example on both my devices. Everything works fine, except few things. One of them, the most annoying for user, is the alert. It looks like in 1 of 10 or even less ticks(or whatever you call it) the device cannot get my location. Even if it's so, I think it’s ok for an entertainment app. How to disable the alert?

Upvotes: 0

Views: 621

Answers (1)

jef
jef

Reputation: 542

The simple way i can think of is to completely disable all alert by altering alert functionality when the document is "ready."

<script>
    document.addEventListener('DOMContentLoaded', function(){ //equivalent to jQuery $('document').ready(function(){})
        /* alert("this will show"); */
        alert = function(){};
        /* alert("ALL alert after this won't show"); */
    }, false);
</script>

Upvotes: 1

Related Questions