9

So I asked something similar yesterday and did receive an answer to my question, however I don't really think I asked it correctly and therefore didn't receive the exact information I needed.

I'm in search of an API, some open source code, or even just a way that someone else has achieved this on the Android. I'm making an app that needs to find all other Android devices within a specified radius. For example, when you open your Android Google Maps App, and you search for say "Restaurants [ZipCode]", it uses a radius modified from your zip code and finds all of those places. The GPS gets YOUR location, and maps uses that information to find restaurants within an address close to that passed in location.

Instead, I want to be able to use the GPS to find my location (as it can now easily), but instead of finding things on a map (which is already built in), I want to be able to find other GPS enabled Android phones. I get that they will have to be broadcasting their GPS signal at the same time as well (since they don't have their data stored with some sort of central database as a restaurant would). However, I don't just want to FIND these phones, I want to send/receive data from these phones (with correct permissions obviously).

Now, I've found things like the Bump API. However, BUMP uses the phones sensors to spark this search. So basically, if you "bump" your phone with another and have the app running, it will THEN go ahead and use GPS to find the location of the other phone you just bumped with and exchange data between them. This is like EXACTLY what I want to do however in their API, they do not provide the functionality to just say, "Hey, give me all phones within a mile from me."

I've also found API's that can do exactly what I need but they have to be on the same Bluetooth range or on the same Wi-Fi network, which doesn't suit what I need at all.

Do you guys know of anything that can fit exactly what I need that already exists? Or a way to maybe modify Bump API (if you've done it), to not have to use the phone sensors and find phone information directly through GPS for phones around you? Or is there something that exists over a 3g/4g network instead of only wi-fi/Bluetooth?

Thanks guys.

slandau
  • 23,528
  • 42
  • 122
  • 184
  • Hi, its been a while since you posted this question, but I found this interesting and would help me out with a project I am doing - did you find anything useful here? Something like "list all phones within a mile from this location"? Thanks – Dr Confuse Oct 14 '16 at 07:14
  • @DrConfuse please read my answer – chinmish Jul 10 '17 at 12:42

7 Answers7

5

Instead of frequently posting locations to an external server, couldn't the GPS realize other things broadcasting a GPS signal at a very specific time and send/receive data from them?

The only things that are "broadcasting a GPS signal" are satellites.

We would like to accomplish this without the use of an external server.

You have no choice but to use an external server, whether you like it or not, both for discovery and for later communication.

Do you guys know of anything that can fit exactly what I need that already exists?

Foursquare, Google Latitude, Yahoo Fire Eagle, and so on.

CommonsWare
  • 986,068
  • 189
  • 2,389
  • 2,491
2

To do this via GPS, you would have to have all the phones frequently posting their locations to a network server, which could then inform them of others nearby.

Needless to say this would be opt-in only!

And it may have negative consequences for battery life, unless you make it update infrequently, which may limit its usability.

The advantage of having an explicit trigger action to both phones is that they only need to query the GPS and inform the server to find each other by location when they've both been triggered.

Chris Stratton
  • 39,853
  • 6
  • 84
  • 117
  • I actually only want to perform the query at a certain time which is triggered by an action from the user. However, I DON'T want this action be a "bump". I want it to be something the user can do without even being near any others. Instead of frequently posting locations to an external server, couldn't the GPS realize other things broadcasting a GPS signal at a very specific time and send/receive data from them? – slandau Feb 04 '11 at 18:08
  • 3
    GPS receivers are passive, they do not transmit anything. So either the device you want to find needs to have already updated a server with its location via the mobile network recently enough to still approximately be where it last said it was, or both devices need to be triggered at the same time to update the server and have it match them up. – Chris Stratton Feb 04 '11 at 18:16
  • Unless they are on a wi-fi/Bluetooth network together correct? Hmm, okay so I guess this is just impossible without an external server you're saying? – slandau Feb 04 '11 at 18:17
  • If they are on wifi or bluetooth together you probably wouldn't need to involve GPS, unless the users do not know each other by name and so physical proximity is the only way to pick the right device from many in the room - but GPS may not be accurate enough for that anyway, especially indoors. – Chris Stratton Feb 04 '11 at 18:21
  • Well it's looking like using an external server may be the only way to go then. We'll have to figure out if cost/benefit is correct for this project now. – slandau Feb 04 '11 at 18:22
  • 1
    It's not the server cost you should be worrying about, but the high cost to users in terms of battery and privacy, which may limit their interest in your application unless you have some serious value to deliver to them in turn. – Chris Stratton Feb 04 '11 at 18:27
  • Well that we wouldn't be worried about. We have a solid product and business plan. So it comes down to server cost. – slandau Feb 04 '11 at 18:38
  • 3
    If you are worried about server cost, it suggests you really do not have a solid business plan or sufficient knowledge of the modern internet economy to write one. If you are not worried about user objections to the battery or privacy issues, it also suggests that you are either so big and securely established by existing business giving you the ability to disregard complaints as to not need to worry about the trivial cost of a server, or you similarly do not know what you are getting into. – Chris Stratton Feb 04 '11 at 18:44
  • Security would be non-existent here. No one would know where data is coming or being sent from, and the data would only be text, and you could choose to not receive it whenever you want. – slandau Feb 04 '11 at 19:41
  • 2
    "Security would be non-existent here" - and that's the problem. You are asking people to trust both your motives and your technical competence, while displaying a poor understanding of the technology. And you are doing this about a subject where even the best companies have a rather poor track record for living up to their promises. – Chris Stratton Feb 04 '11 at 20:02
  • Everything makes sense. Thank you for your insight. – slandau Feb 04 '11 at 21:08
1

The question now has a very simple solution to it. All you have to do is set up a Geofence and monitor it for entry and exit of users. Geofence allows you to choose a geolocation and set a circle of desired radius around it. When someone enters or exits the location you can get notified and perform desired action.

Visit this link for further details on how to use this in Android.

chinmish
  • 99
  • 1
  • 11
1

You would probably have to author your own application - then you could do this server-side and push things. If you're trying to push data to random Android phones - you're out of luck. Most people aren't going to want this, and probably aren't going to have the apps necessary to receive and understand it. With Bluetooth networking you'd need authorization, and most Androids don't have a capability to transfer random data by Bluetooth out of the box (though you certainly can get software to do it).

Honestly, malware and tracking are the reasons this really isn't possible, but even if they weren't, you would still need an application on the receiving devices that understand what you're sending them. And if you're widely spread enough, you'd probably want to send it to a server to disseminate anyway (for the transmitting phones bandwidth costs at least).

Chris K
  • 11,996
  • 7
  • 37
  • 65
  • That's actually the whole purpose. I'd ONLY be sending this data to other phones that are running my application as well and have committed to this process. They would also be able to change their settings at any time. – slandau Feb 04 '11 at 18:10
  • Then you have to implement the searching on the server side. Periodically you would have the phone send it's location to the server and find out if there is data waiting for it (once a minute, every 5 minutes, an interval set by the user). – Chris K Feb 04 '11 at 18:42
  • Would I be able to use Google Latitude as the server? – slandau Feb 04 '11 at 19:21
  • Entirely possible. You could use Google App Engine and Google Storage to push your data from mobile-to-mobile. You'd still need an application on the server side to tell the "remotes" that there's some data to retrieve. – Chris K Feb 04 '11 at 19:33
  • 1
    Basically something that runs every so often and says, you're in range of some new data, get it...right? – slandau Feb 04 '11 at 19:38
1

Develop a server application that your android app logs into. Send the GPS location every time the phone moves over a present distance. Either send a query request to the server to ask it if any other phones are in range, or get the server to inform the phone of a new device in range.

You may run into server scalability problems, so thats something to think about. Also, this would be a big battery drain, and so your users may not be too keen to run it, not to mention the privacy element.

FlappySocks
  • 3,772
  • 3
  • 32
  • 33
  • We would like to accomplish this without the use of an external server. If you see my below comment, users can only receive data if they are ALSO running the same app and have accepting terms and conditions to do so. Also, they can change their settings at any time. – slandau Feb 04 '11 at 18:12
  • You cannot accomplish this without an external server unless you use a peer-to-peer communications channel such as bluetooth, which requires manual confirmation for pairing with a specific target device. Even wifi will typically require a server in the form of an access point (ad-hoc being possible in some cases but unlikely) – Chris Stratton Feb 04 '11 at 18:23
  • Seems to be the answer going on. Thanks guys. – slandau Feb 04 '11 at 18:38
1

You need to rethink what you're trying to do. Android devices don't "transmit" any GPS signal, they are simply receivers, with signals from satellites. So the phone can easily get a location for itself, but the location of other devices is very, very private information. To get access to location for other phones, you either need to be on the same network as them (bluetooth, wifi), or you need them to use a server-based service to send locations to, like Google Latitude.

I'd be highly unlikely to sign up to a service like that. My location is very private, I share it with some people, but I cannot seem myself openly sharing it with an app, without a very, very good reason.

It seems to me that you need to build a server-based application, e.g. on Google App Engine, have people sign up, and agree to their location being sent to that server, so other phones running your app can access that information from the central store.

Ollie C
  • 28,313
  • 34
  • 134
  • 217
  • The sender does not know anything about the devices he is sending it to. He/she will never know if another device even gets any data. All he knows is that data will be sent to other users of the app if they are within range. That's all. And ONLY if they allow themselves to do so (have the app open and accepting data). – slandau Feb 04 '11 at 18:15
  • Unless both devices are on bluetooth/wifi networks together (and even then with limitations) you can't just "send" data between devices because they're near each other. If you want devices to share their locations, you are highly likely to need to build a server-based application to collect locations, and redistribute them (like Google Latitude). Your server-app could then just provide location data to other users, when the distance between those users is below a certain threshold. But you're going to have to do this via a server in the cloud, there's no way to do it directly between devices. – Ollie C Feb 04 '11 at 18:28
  • As much as I don't like that answer, haha, I think it's the right one. Thank you Ollie. – slandau Feb 04 '11 at 18:34
0

All the comments from other folks about not being able to pick up the signal from others phones are correct. There is a completely different alternative system however in the network based location services. This is a model where you ask a carrier network for the location of a handset, which the carrier network needs to track for enhanced 911 service in the US (I'm unaware of how widely deployed this is in other areas, and how many different services you would need to use to cover other areas).

It's potentially a very expensive route however. And it won't just automatically work for all handsets, I believe the users will have to be opted into sharing location with your service. This is how services like Loopt had initially setup their location info so that it could be passively collected without negatively impacting handset battery life. There are some third party services that front for a cross-carrier service such as Location Labs:

http://locationlabs.com/

As well as third party location services like Skyhook Wireless, who might be able to get you some info of the sort (though I don't think what you're looking for maps to any of their existing APIs)

mikerowehl
  • 2,222
  • 1
  • 17
  • 20
  • Hmm, this is definitely interesting. There "pinging" service is very similar to what this app was going to implement. Do you know where I can find more information about this "pinging people close-by" attribute? – slandau Feb 04 '11 at 20:44
  • You should be able to dig up more info here: http://developer.veriplace.com/devportal/locationAccessOverview I'm only familiar with the services in general though, beyond what's there probably best to just contact the company and find out what they offer. – mikerowehl Feb 04 '11 at 21:29