2016-03-29 24 views
0

Aygıtın geçerli konumunu, konum olarak Konumlandırma nesnesi olarak konum belirleme işlevi ile döndürür. Bir hata varsa, geolocationError geri çağrısı bir PositionError nesnesinden geçirilir.phonegap dosyasında geri çağrının anlamı nedir

navigator.geolocation.getCurrentPosition(geolocationSuccess, 
             [geolocationError], 
             [geolocationOptions]); 

cevap

0

geolocationSuccess Eğer bir şeyler ters giderse herşey yolunda olduğunu ve hata bu durumda tetiklenmesini, tanımlamak zorunda olduğunu, bir işlevdir

Örnek:

geolocationSuccess: function() { 
    alert ("OK to get geolocation!") 
} 

geolocationError: function() { 
    alert ("Something went wrong on geolocation") 
} 

navigator.geolocation.getCurrentPosition(geolocationSuccess, 
             geolocationError, 
             [geolocationOptions]);