Want To Build Attendance Tracking System With Gps Latitude And Longitude
build a algorithm to find a polygon build by four sets of lat long.. and passing current lat long to find whether a set of lat long belong to that polygon or not. But the the curre
Solution 1:
You can find location using the below code:
Declare the variable:
LocationManager lm;
LocationListener ll;
Start Location listener :
lm = (LocationManager) getActivity().getSystemService(Context.LOCATION_SERVICE);
ll = newstartLocationListener();
lm.requestLocationUpdates(LocationManager.GPS_PROVIDER, 0, 0,ll);
Location listener:
classgpsLocationListenerimplementsLocationListener {
publicvoidonLocationChanged(Location location) {
if (location != null) {
String latitude = location.getLatitude();
String longitude = location.getLongitude();
}
}
publicvoidonProviderDisabled(String provider) {
}
publicvoidonProviderEnabled(String provider) {
}
publicvoidonStatusChanged(String provider, int status, Bundle extras) {
}
}
After finding location you can stop listener using this in onLocationChanged:
lm.removeUpdates(ll);
lm = null;
Post a Comment for "Want To Build Attendance Tracking System With Gps Latitude And Longitude"