wood burning stoves 2.0*
The moose likes Android and the fly likes Is there a way to force Location Updates Via cell Tower? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Mobile » Android
Bookmark "Is there a way to force Location Updates Via cell Tower?" Watch "Is there a way to force Location Updates Via cell Tower?" New topic
Author

Is there a way to force Location Updates Via cell Tower?

zoheb hassan
Ranch Hand

Joined: Apr 01, 2009
Posts: 153

Hello Guys i am working on an Location aware Application, I want to use NETWORK_PROVIDER to receive location updates and by Network updates i mean to say Cell-Tower location update only, No Wi-Fi, no Gps, No GPRS while tried using the Network Provider and passive provider but the last known location method only fetches updates that were fetched when i connected to wi-fi network the last time, Is there any way to get the cell tower location updates only??
mitch mccann
Greenhorn

Joined: Apr 20, 2011
Posts: 7
Ed Burnett's book has a program... LocationTest Chapter 8, page 153, I got the program to work. It gives lots of info about all the "providers."

I wonder if cell towers get information about the exact location of stationary wifi hot spots in their service area from packets generated by mobile users... Skype etc. If I were Big Brother I'd be tracking stuff like that.


Doing Android without learning Java is dumb.
zoheb hassan
Ranch Hand

Joined: Apr 01, 2009
Posts: 153

Hey mitch will explore what you pointed Thanks

Checked it out that code provides data about the providers and its properties but not the Solution i am looking for
mitch mccann
Greenhorn

Joined: Apr 20, 2011
Posts: 7
R.
Sounds like you want to "ping" the local towers?
Cm,
zoheb hassan
Ranch Hand

Joined: Apr 01, 2009
Posts: 153

Exactly get the location details from the local towers but what does R. and Cm mean??
mitch mccann
Greenhorn

Joined: Apr 20, 2011
Posts: 7
"R," is you. I probably should have put "Z" of "H," but I guess I saw the "R" in Ranch Hand. I am cm, or CactusMitch.
How do you prefer to be addressed? realize that you name is not on this "REPLY" screen and there are potentially others in the discussion.

I presume that in the USA, the Federal Communications Commission maintains a public list of cell tower locations,, i.e. LAT and LON. Getting the location of the towers from a handheld device might be possible by collecting the signal strength against a record of the location of the handheld device as it explores the area as recorded from some other source of location information like a map or GPS. Then there is the trigonometry. Sounds like going around the barn to get to the door.

Do you want to find the location of the tower, or the location of the device relative to the tower? The direction to go to get a better signal?

I am working on a project to find the the Android device relative to the proximate entries in a big database of locations.

Best regards, cm (CactusMitch)
mitch mccann
Greenhorn

Joined: Apr 20, 2011
Posts: 7
Z,
Second thoughts, sounds like you will have to be satisfied with COURSE location information,,, i.e. knowing only which Cell Tower coverage area your Android device is operating in.

I don't think that towers have aimed directional antennas. When in range of two or more towers, more specific location might be possible. Again I think that economics of tower operation suggests that towers of the subscriber's service are used in preference to towers owned by competitors, even when radio engineering might suggest the customer is better off on roaming.... Or maybe it's the other way around. economics dictates..

cm (CactusMitch)
zoheb hassan
Ranch Hand

Joined: Apr 01, 2009
Posts: 153

To the guest authors of pro android 3, is it possible to receive location updates without using gprs, 3G, Wi-Fi but only using the cell tower, what other information could be extracted
Dave MacLean
author
Ranch Hand

Joined: May 10, 2011
Posts: 49

It should be possible to receive location updates from the cell towers using the NETWORK_PROVIDER. However, depending on your current location, your device may not be receiving enough information to be able to triangulate a good position. That may be why getLastKnownLocation() is returning an old value. Or, perhaps your Location settings are such that "Use wireless networks" is off? In your code, do you check that the NETWORK_PROVIDER is enabled? "Force" is a strong word. If you only try using the NETWORK_PROVIDER, you're only using cell towers or wi-fi to determine location. You realize of course that the accuracy of your location is not very good. Also, you need the appropriate permission set to access the NETWORK_PROVIDER (android.permission.ACCESS_COARSE_LOCATION).

We devote chapter 17 to maps and location services, with several example applications.

If that's not working, could I take a look at your code somehow?

- dave

Dave MacLean our book (Pro Android 4)
zoheb hassan
Ranch Hand

Joined: Apr 01, 2009
Posts: 153

Hi Dave,

I made the necessary changes you suggested, earlier i was using PASSIVE_PROVIDER now i am using NETWORK_PROVIDER, the phone settings like "Use Wireless Networks" is checked the result however is the Same it shows the time when the phone connected to Wi-Fi Network and i do know that the accuracy may not very fine when i use the NETWORK_PROVIDER but i want to conserve on the battery and i will post the code



the manifest uses permission to access both coarse and fine locations
Dave MacLean
author
Ranch Hand

Joined: May 10, 2011
Posts: 49

Interesting. Obviously your code is okay in that it compiles and runs and displays a location. I'm surprised though that the NETWORK_PROVIDER is not giving you a more recent location value. Your device does have 3G, right?

A quick note on the PASSIVE_PROVIDER: it is what it says it is. Meaning, that provider relies on some other provider working simultaneously so the PASSIVE_PROVIDER can piggyback on the other provider. It saves a little bit because you're basically reusing the other provider. It's a special case where you'd use it since you have to know that some other provider is in operation, otherwise you won't get any meaningful updates. Now to your problem...

I would expect that the NETWORK_PROVIDER would be updating the last known location even though you haven't asked the provider to send you updates. That doesn't seem to be the case for you. What device is it? The usual way to work with a location provider is to set it up as you've done, but then in onResume(), you'd make a call like this:

locMgr.requestLocationUpdates(LocationManager.NETWORK_PROVIDER,
60000, // time in milliseconds
100, // distance in meters
loclistener);

where loclistener is an instance of a LocationListener. That class has a method called onLocationChanged(Location location) which will be called when there's a new position to report. In your onPause(), you'd also want to call locMgr.removeUpdates(loclistener)

For the request updates call, you give it how often you want to be updated, and how far the new position must be before reporting it. So in this example, you would be notified when the location appears to have moved 100 meters, and would not get notified more often than approximately every minute. These are guidelines and not precise. You could use different values depending on your need.

- dave
zoheb hassan
Ranch Hand

Joined: Apr 01, 2009
Posts: 153

Hi Dave my device is LG P500 Optimus One, It does have 3G but i have not enabled it.

There is one more Observation i made today, I switched my Cell Phone off for a period say about 8-9 hours and when i ran the same code without making any connection to network i.e., Wi-fi or Gprs, i got the value "No Details Found". What i understand from this is that the device needs to connect to the network in some form say Gprs, Wi-fi or 3G to fetch the location updates from a NEWORK_PROVIDER. I hope that this observation is correct and please correct me if i am wrong about this.

Well moving on to my actual question "if its possible to find location details using cell Tower like in your nokia phones when you enable "Cell Info Display" you would on your Main Screen get details of where you are. I thought the same was possible on Android.

Whew that is such a lengthy text, It is going to give guys reading it a good workout

-Zoheb
Dave MacLean
author
Ranch Hand

Joined: May 10, 2011
Posts: 49

You are correct. In order for the NETWORK_PROVIDER to be able to provide a location to your app, it has to be able to talk to cell towers (3G) or to Wi-Fi. Although to be honest, I'm not sure how it derives location from a Wi-Fi hotspot. In this case, I just trust that somehow it knows how to do that. I've tested NETWORK_PROVIDER on other devices and had no problems getting a location. It's not very accurate, maybe within a mile or so of the true location, but it does provide a location.

- dave
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: Is there a way to force Location Updates Via cell Tower?