Getting location offline
I want to get the value of Longitude and Latitude of my current locatoin when offline and save the current location to its database. Is it possible to get the longitude and latitude of the device when mobile data and wifi are off but the GPS is ON? Just use this code. Make sure the user hasn't selected wifi only or network only option in his location setings. it has to be high accuracy or GPS only. This piece of code will work. public class Location extends AppCompatActivity { LocationManager locationManager; Context mContext; @Override protected void onCreate(Bundle savedInstanceState) {