I am trying to get location from the Tizen.Location.Locator
using the GetLocation
method but I'm getting the values of latitude and longitude set to 0
.
I am using:
- Visual Studio 2017
- Emulator of Wearable 4.0
- Have already granted the privileges for using location, also added the location feature in the manifest file.
Here's my code:
private static Locator locator = new Locator(LocationType.Gps);
try
{
if (locator != null)
{
// Starts the Locator
locator.Start();
//Get Location
Tizen.Location.Location currentLocation = locator.GetLocation();
//Update xaml view
latitudeValue.Text = currentLocation.Latitude.ToString();
longitudeValue.Text = currentLocation.Longitude.ToString();
}
}
catch (InvalidOperationException exception)
{
// Exception handling here
}
there's no description available about the variable currentLocation
since it is being treated as a bool
there. When I try to get the description by the quick watch feature of Visual Studio (by pressing Shift + F9
), I get another error related to conversion of that bool variable
member reference base type 'bool' is not a structure or union
The above code is not showing any ServiceStateChanged
event registered, but I've also included that using the way shown in the sample code, but it didn't work for me.
Now wondering about what I'm doing wrong here.
Your GPS most of time inactive because of battery consumption or Get location via Service provider
or
Use this Plugin to Get Current Location - https://github.com/jamesmontemagno/GeolocatorPlugin