Closed RajeshRajendiran closed 9 years ago
Thanks for your question!
Please test the code on a real device to rule out the emulator as the cause for this problem.
Did you add one of the permissions to your app? Otherwise, your code looks okay.
On the emulator, you have to specifically enable location support and you have to set a faked location or mock location. If that's really what you want to do, you may read more here: http://stackoverflow.com/questions/2279647/how-to-emulate-gps-location-in-the-android-emulator
Thanks for your support dude, I checked real device worked perfectly
Hi thanks for your Java class, After implementing code from your class i get Location is=0.0,Latitude=0.0 my code here protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.distance_find); if (findComponentID()) { getToolBar(); getDrawerList(); location = new SimpleLocation(this); if (!location.hasLocationEnabled()) { // ask the user to enable location access SimpleLocation.openSettings(this); } imgBtnGetLocation.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { getCurrentLocation(); } });
@Override protected void onResume() { super.onResume(); location.beginUpdates(); }