2017-12-07 1 views
0

Ich möchte Cordova Request Location Accuracy Plugin in meiner Phonegap App verwenden ich füge in meine config.xml und dann versuche ich cordova.plugins.locationAccuracy.request(); aber meine Konsole wirft TypeError: cordova.plugins.locationAccuracy ist undefined Was vermisse ich? Danke !!Cordova Anfrage Ort Genauigkeit Plugin

+0

Können Sie Ihre config.xml hinzufügen? – live2

Antwort

0

Wenn Gebäude vor Ort, stellen Sie sicher, dass es in Ihrem Projekt installiert ist:

$ cordova plugin add cordova-plugin-request-location-accuracy 

Oder wenn Gebäude in Cloud (zB Phonegap Bauen), stellen Sie sicher, dass es in der config.xml referenziert ist:

<plugin name="cordova-plugin-request-location-accuracy" spec="*" /> 

Warten Sie dann auf das Ereignis deviceready, bevor Sie auf das Plugin verweisen, da Cordova die JS-Plugin-Komponenten zur Laufzeit dynamisch lädt:

document.addEventListener("deviceready", function(){ 
    cordova.plugins.locationAccuracy.request(); 
}, false); 

Überprüfen Sie die plugin documentation für Plattform-spezifische und die example project für eine Illustration der Verwendung.

+0

Vielen Dank Ich war in der Region! – stef