Phenomenon: Cannot call the function of_getcurrentposition to get the current position.
Solution 1 (this soluiton is working only for iOS devices): There should be at least one second interval between calling the of_getcurrentposition function and the of_open function, the example is shown as below.
if appeongetclienttype()="MOBILE" then eon_mobile_geolocationex lgnv_aws lgnv_aws = CREATE eon_mobile_geolocationex If lgnv_aws.of_isenabled() = 1 Then lgnv_aws.of_open (0, 1) sleep(1) lgnv_aws.of_getcurrentposition (astr_coordinates) lgnv_aws.of_close() messagebox('Long',astr_coordinates.dec_longitude) messagebox('Long',astr_coordinates.dec_latitude) Else messagebox('', 'GPS Disabled') End If destroy lgnv_aws end if |
Solution 2 (this solution is working for iOS and Android devices): Alternatively, you can separately execute the of_getcurrentposition function and the of_open function as the example shown below.
//instance variables of w_1 window eon_mobile_geolocationex ignv_aws //in the constructor event of w_1 window …… if appeongetclienttype()="MOBILE" then ignv_aws = CREATE eon_mobile_geolocationex If ignv_aws.of_isenabled() = 1 Then ignv_aws.of_open (0, 1) Else destroy ignv_aws messagebox('', 'GPS Disabled') End If end if …… // in clicked event of cb_1 of w_1 window …… if isvalid( ignv_aws) then ignv_aws.of_getcurrentposition (astr_coordinates) ignv_aws.of_close() messagebox('Long',astr_coordinates.dec_longitude) messagebox('Long',astr_coordinates.dec_latitude) end if …… |