Hi every one,
I meet a problem when get geolocation in mobile application.
I created an app for check-in a task. When I debug in 1C:Enterprise Mobile Platform It works perfectly but when I created an application(I created an *.APK file by using "Application Collector For Mobile Device") It isn't works. So, what is the problem in this case.
Thank you in advance.
Duc Tien NGUYEN
Here is my function to get Geolocation:
Quote |
---|
Function DefineCurrentGeocoordinates() Export #If MobileAppClient Then Message("Da vao"); CurrentProvider = "gps"; Try DM = LocationTools.GetLastLocation(CurrentProvider); Except DM = Undefined; EndTry; If DM = Undefined Then CurrentProvider = "network"; Try DM = LocationTools.GetLastLocation(CurrentProvider); Except DM = Undefined; EndTry; EndIf; If DM = Undefined Then Return Undefined; EndIf; If CurrentDate() - ToLocalTime(DM.Date) > 100 Then LocationTools.UpdateLocation(CurrentProvider, 5); DM = LocationTools.GetLastLocation(CurrentProvider); EndIf; YES = GetAddressByLocation(DM.Coordinates); If YES = Undefined Then CurrentLocation = "Lat: " + DM.Coordinates.Latitude + ", Lon: " + DM.Coordinates.Longitude; Иначе CurrentLocation = СтрЗаменить(YES.Presentation, Chars.LF, ", "); EndIf; CurrentLocation = CurrentLocation + "Date: " + ToLocalTime(DM.Date) + ", Provider: " + CurrentProvider; Возврат DM.Coordinates; #Else Return Undefined; #EndIf EndFunction |