2

I am using sygic map. When I try to get location in sygic map I can not get nothing. My code is as below:

boolean satInfo = true;
int maxTime = 0;
GpsPosition gpsPos = new GpsPosition();
gpsPos = ApiNavigation.getActualGpsPosition(satInfo, maxTime);
Position pos = new Position();
pos.setPosition(gpsPos.getLongitude(), gpsPos.getLatitude());
strCurrAddress = ApiLocation.getLocationAddressInfo(pos, maxTime);
Log.e("GpsPosition", "Error code:" + strCurrAddress);
edtAddress.setText(strCurrAddress); 

Your answer would be appreciated.

General Failure
  • 2,421
  • 4
  • 23
  • 49

1 Answers1

0

This could be the possible solution :

GetAddress();

void GetAddress()
{
    int lat;
    int lon;
    GetActualGpsPosition(true, out lat, out lon);
    string address = ReverseGeoCode(lat, lon);
    Debug.WriteLine("address:" + address);
}

public void GetActualGpsPosition(bool bSatellitesInfo, out int lat, out int lon)
{
    SError err;
    SGpsPosition gpos = new SGpsPosition();
    int ret = CApplicationAPI.GetActualGpsPosition(out err, out gpos, bSatellitesInfo, 0);
    lat = gpos.Latitude;
    lon = gpos.Longitude;
}

string ReverseGeoCode(int lat, int lon)
{
    string strAddress;
    SError err;
    LONGPOSITION lp = new LONGPOSITION(lon, lat);
    SRoadInfo sri = new SRoadInfo();
    int ret = CApplicationAPI.GetLocationInfo(out err, lp, out strAddress, out sri, 0);
    if (ret != 1)
    {
        return "";
    }
    return strAddress;
}
Nik Patel
  • 627
  • 7
  • 21