Languages

Menu
Sites
Language
Why GPS location can not be stop and started...?

Hello everybody. I have very strange problem. I need simply start GPS - get actual position - save it - stop GPS. Repeat every 5 minutes for example.

Lets start with simply start - get - stop. I am trying to figure it out why it is not working. It is working first time. Start - Get position - Stop. After, lets say, 30 second I call this exactly the same function again. And nothing happend. Location is not changing (yes, I am in other location...) and GPS is not working. I really dont know why.

try
{       
   Tizen.Location.Locator locator;
   locator = new Locator(LocationType.Hybrid);
   
   // START
   locator.Start();
   
   // GET
   Tizen.Location.Location location = locator.GetLocation();
                
   if (location != null)
   {
      gps_location_latitude = location.Latitude.ToString().Replace(",", ".");
      gps_location_longtitude = location.Longitude.ToString().Replace(",", ".");

      latitude.Text = String.Format("{0:F5}", gps_location_latitude);
      longitude.Text = String.Format("{0:F5}", gps_location_longtitude);
   }
   else
   {
      latitude.Text = "not found";
      longitude.Text = "";
   }

   // STOP ... I try every possible variants of those below. It simply HARD-stop GPS and never start again.
   locator.Stop();

   //locator.Dispose();
   //locator = null;

}

 

Is there are any tizen, c#, .Net, xamarin guru, who help me with this flustrating problem? :-)

 

Roman