Desktop version

Main > Forum > 1C:Enterprise Platform > 1C:Enterprise. Mobile platform > Mobile Platform Get Location Error

Forum

Search UsersRules
Mobile Platform Get Location Error
#1
Active user
Points:: 0
Joined:: Mar 29, 2016

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

Profile
#2
Interested
Points:: 0
Joined:: Apr 5, 2012

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.

Profile
#3
Active user
Points:: 0
Joined:: Mar 29, 2016

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;

Profile
Subscribe
Users browsing this topic (guests: 1, registered: 0, hidden: 0)



© 1C LLC. All rights reserved
1C Company respects the privacy of our customers and visitors
to our Web-site.