I am trying to fetch Gps latitude and longitude, but i am having a query that whenever i try to fetch Lat & Long without sim card, it is not providing any info where as soon i insert my sim card, it provides me all information in desired manner.
LocationManager mlocManager =
(LocationManager) getSystemService(Context.LOCATION_SERVICE);
LocationListener mlocListener = new MyLocationListener();
mlocManager.requestLocationUpdates(LocationManager.GPS_PROVIDER,
0, 0, mlocListener);
you can see though i m using GPS_PROVIDER, it is not giving me Lat & Long without Network Operator help, can anybody tel me?
Another thing is How to start and stop GPS from an application means i wanna start gps after particular time and than as soon i get beslocation, i can turn it off.
You don't need to have access to any network to get a GPS location on Android. But an internet connection speeds-up the location fix from about 5 minutes to 5 seconds (approximately)! This improvement is brought by Assisted-GPS (A-GPS), as opposed to standalone-GPS.
GPS phones (including Android devices) check if a network connection is available. If so, they download assistance data from and A-GPS server and use it to compute the location fix with the GPS chipset. If not, the GPS chipset has to download the data from a GPS satellite, which takes a long time (rate is 50 bits per second!). The process can also be sped up if a GPS location has been computed not too long ago.
So first:
Then start your app and wait, there can be a few minutes before the first fix is available.
As for starting the GPS from your app, it seems possible (see How can I enable or disable the GPS programmatically on Android?), but I don't know how! At least you can download Tasker and program it to start/stop the GPS.