Why GPS location can not be stop and started...? (Tizen / Xamarin wearable development)

Roman Rusz 21 Reputation points
2021-04-21T07:04:07.777+00:00

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)
   {   
      latitude.Text =  location.Latitude.ToString();
      longitude.Text =  location.Longitude.ToString();
   }
   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. Simply when you call STOP and after you call START - it will not start again..
   locator.Stop();

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

}

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

Xamarin
Xamarin
A Microsoft open-source app platform for building Android and iOS apps with .NET and C#.
4,809 questions
C#
C#
An object-oriented and type-safe programming language that has its roots in the C family of languages and includes support for component-oriented programming.
6,946 questions
No comments
{count} votes