Mobile Platform Get Location Error

Discussions regarding 1C:Enterprise for mobile devices with Android, iOS, or Windows Phone.

#1
People who like this:0Yes/0No
Active user
Rating: 5
Joined: Mar 29, 2016
Company: DND YAZILIM LTD.

Hi everyone,

I working on mobile platform now. I want to use get current location for android tablet. I Try this code but platform give an error "Coordinates" and "GpsProvider.Name". How i fix this problem?

Code
#If MobileAppClient Then      
    GpsProvider = LocationTools.GetProvider("network");
    GLocation = LocationTools.GetLastLocation(GpsProvider.Name);
    Message(String(GLocation.Coordinates.Latitude));
#EndIf

Edited: Hüseyin Çağrı Bayraktar - Feb 04, 2017 12:49 AM
 
#2
People who like this:0Yes/0No
Interested
Rating: 27
Joined: Apr 5, 2012
Company: 1TÇ Şirketi - Merv Bilgi İşlem Otomasyonu Yazılım Ltd. Şti.

Dear Hüseyin Çağrı Bayraktar,

In the first versions of demo mobile application configuration there was a functionality that shows nearest counterparty. I think there you can find out your needs.

 
#3
People who like this:0Yes/0No
Active user
Rating: 5
Joined: Mar 29, 2016
Company: DND YAZILIM LTD.

I fix this problem,

Code
GpsProviders = LocationTools.GetProviders();
      FounGpsProvider = Undefined;               
      For Each CrrGpsProvider In GpsProviders Do
         If ( Not CrrGpsProvider.Paid )  And ( CrrGpsProvider.UsesCellNetwork ) Then
            FounGpsProvider = CrrGpsProvider;
            Break;
         EndIf;
      EndDo;
      
      If FounGpsProvider = Undefined Then
         ShowMessageBox(,"Not Found!");
      Else
         Latitude = String(LocationTools.GetLastLocation(FounGpsProvider.Name).Coordinates.Latitude);
         Longitude = String(LocationTools.GetLastLocation(FounGpsProvider.Name).Coordinates.Longitude);
      EndIf;

 
Subscribe
Users browsing this topic (guests: 1, registered: 0, hidden: 0)
Be the first to know tips & tricks on business application development!

A confirmation e-mail has been sent to the e-mail address you provided .

Click the link in the e-mail to confirm and activate the subscription.