I am using GPS_PROVIDER to get location information ,but it does not work perfectly in some places. Is there any problem when use Gps_Provider. As I know Network_Provider does not give perfect location information. Please help
Related
I am developing an android application in which i want to use wifi only to find user's location is it possible to find location of your device just by using Wifi ?
In this app i m trying to guide user to go from one place to another inside a building so i want exact location cell tower location or gps location will not be of any help
LocationManager.NETWORK_PROVIDER will use either Wifi or cell tower location (not GPS). If you want the best location, that would be fine GPS (wifi is the least accurate.) You can ask the LocationManager to getBestProvider and require fine GPS with:
criteria.setAccuracy(Criteria.ACCURACY_FINE);
Based on your latest comment, I think you would like to guide a user inside a building and somehow get more accurate locations than a gps location (which would probably not be accurate inside a building anyway). While there may be some specific situation in which this would be possible, I would say no, there is not a general solution that could be applied.
For Current Location, using GPS is highly recommended. Because with only Wifi, it will not be accurate. But still you can use this:
String uriName = "geo:"+ lat+ "," + lon+ "?q=my+street+address";
startActivity(new Intent(android.content.Intent.ACTION_VIEW, Uri.parse(uriName)));
This should work with roughly accuracy.
I think you want to guide the user while inside the building, if so, then I don't think that GPS or Wifi will be able to help you.
GPS provides a very fine location but require clear contact with the gps satellites in the space which won't be available inside buildings. Also the accuracy is within some meter distance which won't be effective in your case.
Cellular wifi will provide you location using the nearby cell tower which i think is self explanatory in your case. So, I don't think that both location services will of use in your case.
Hi, I am trying to get the gps location using location provider and gps provider at the Same time. I am trying for last two days but stil am struggling. I don't know how to do this,I am searching and get this link http://www.hrupin.com/2011/04/android-gps-using-how-to-get-current-location-example, but it's also getting force close. Anybody kindly give working example for gps usind network provider and gps provider
The link you provided is good only. So many examples available in web, one of them is given below.
Using GPS to get current location – Android tutorial
I hope it may help you.
In my Application i need to use user's current location.
Through GPS, i knw how to do it but can any body have idea that how it can be done using Wifi?
Pls do my help,
thanks.
Have a look at the Android Obtaining User Location documentation - especially the usage of the NETWORK_PROVIDER.
I am developing a android application in that i want find the user location using GPS. That is working fine .But if the GPS is Disabled means i want to find the user location based on the CellID and Loc .It is possible or not
It is possible means please tell me how to do that with sample code
Waiting for reply
Just request the "best" location provider, and you'll either get the GPS if it's available or the network (wifi / cell) if it's not.
LocationManager.getBestProvider()
You don't need to explicitly code to either GPS / network providers.
Here is complete tutorial of Location-Based Services Using CellID in Android.
i did the GPS application which gets the current location.It is working in android emulator by using DDMS perspective(by passing mock location).But it is not working in android phone and phone is Samsung gt-i5801.please help me.
And one more thing i want to ask you guys.
(Why i need Gps) bcoz
in my appln i want to display the nearest cinema theatres by using latitude and longitude.
Is there any other way to do that.
Please tell me.
I think there is no problem in your code if it runs in emulator. But you have not start the gps on your phone, so it's giving a null pointer exception.
So now when you use gps, first check whether gps is on or not. Then fetch lat. and long.
You can check your gps is on or off by this:
LocationManager mlocManager = (LocationManager)getSystemService(Context.LOCATION_SERVICE);
boolean val= mlocManager.isProviderEnabled(LocationManager.GPS_PROVIDER)
First of all, tell us what errors are you getting when you run it on the device. Logcat messages!?
Secondly, there must be any webservice which gives you the nearby cinema theatres, so you might be required to give it your current location in latitude and longitude.
For getting your current location, GPS is necessary.
On the other note, you can also use NETWORK_PROVIDER to get your current location.