I have an application, where I need to get the coordinates of where the cell phone is when I open the registration form and then when I register, to store the 2 locations. How do I get the location of my cell phone?
I have an application, where I need to get the coordinates of where the cell phone is when I open the registration form and then when I register, to store the 2 locations. How do I get the location of my cell phone?
1. Set the non-manifest to use GPS:
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION">
2. Create a LocationManager
LocationManager gerenciadordeLugar = (LocationManager) : getSystemService(Context.LOCATION_SERVICE);
3. Make sure the GPS is turned on.
4. Implement a Listener and get the coordinates:
LocationListener meuListener = new MeuListener();
locationManager.requestLocationUpdates(
LocationManager.GPS_PROVIDER, 5000, 10, meuListener);
I'm using the code below at this time. The %code% is obtained, but does not eliminate the masks to make the comparison in %code% . Anyone have any suggestions?
%pre%You can get the value of %code% in two ways depending on what you need:
Permanent
In your MaskedTextBox change the value of the property %code% to %code% . This way, you can use %code% (anywhere) and the value returned will be the text without the mask.
Temporary
If you need the value with the mask in other parts of the code and want to remove the mask only for %code% you can do the following:
%pre%Note: None of the solutions change the visual appearance of %code% .
Example:
An example of the code you can use within the event of a button (tested in VS2013, .NET4.5):
%pre%