Skip to content
Snippets Groups Projects
Commit 95694a21 authored by kishoreraju2's avatar kishoreraju2
Browse files

GPS enabled

parent 0c7e146a
No related branches found
No related tags found
No related merge requests found
......@@ -65,6 +65,12 @@ public class CameraFragment extends Fragment {
FirebaseUser user;
FirebaseAuth firebaseAuth;
private com.mapps.seproject.TrackGPS gps;
double longitude;
double latitude;
String city;
String postalCode;
@Override
......@@ -136,6 +142,23 @@ public class CameraFragment extends Fragment {
if (requestCode == CAMERA_CAPTURE_IMAGE_REQUEST_CODE) {
if (resultCode == RESULT_OK) {
uploadFile();
gps = new TrackGPS(getActivity());
if(gps.canGetLocation()){
longitude = gps.getLongitude();
latitude = gps .getLatitude();
city = gps.getCity();
postalCode = gps.getPostalCode();
Toast.makeText(getActivity(),"Longitude:"+Double.toString(longitude)+"\nLatitude:"+Double.toString(latitude)+"\nCity:"+city+"\nPostal:"+postalCode,Toast.LENGTH_SHORT).show();
}
else
{
gps.showSettingsAlert();
}
} else if (resultCode == RESULT_CANCELED) {
// user cancelled Image capture
Toast.makeText(getActivity(),
......
......@@ -49,15 +49,17 @@ public class TrackGPS extends Service implements LocationListener {
boolean canGetLocation = false;
Location loc;
double latitude;
double longitude;
String city;
String postalCode;
String UserEmail = null;
final DatabaseReference mDatabase = FirebaseDatabase.getInstance().getReference("users");
private com.mapps.seproject.TrackGPS gps;
double longitude;
double latitude;
String city;
String postalCode;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment