1

I'm far to be an expert on Android programming, so I don't have any idea about if this is possible, so let me split my doubt in three questions:

1) Is it possible for an Android app to detect all the other Android devices in a map that have the same app installed, within a radius previously given (for example, say 5 km)?

2) If yes, is it also possible to show their phone numbers (with their consent, of course)?

3) How much time, approximately, would an experienced Android programmer need to do that?

ngrashia
  • 9,869
  • 5
  • 43
  • 58

1 Answers1

1

To answer your question

  1. YES! Possible provided

    • All the users within the prescribed radius should have GPS enabled and you should be having the lat/long of all users current coordinates(Or atleast last known coordinates should be saved periodically) saved in DB.

    • To calculate the 5 km radius, you can use oracle query and function that gives you the list of closest people. Below function gives you the distance between 2 geo-coordinates in KM. create or replace FUNCTION CALC_DISTANCE (Lat1 IN NUMBER, Lon1 IN NUMBER, Lat2 IN NUMBER, Lon2 IN NUMBER) RETURN NUMBER IS -- Convert degrees to radians DEGTORAD NUMBER := 57.29577951; Radius NUMBER := 6387.7; BEGIN RETURN(NVL(Radius,0) * ACOS((sin(NVL(Lat1,0) / DegToRad) * SIN(NVL(Lat2,0) / DegToRad)) + (COS(NVL(Lat1,0) / DegToRad) * COS(NVL(Lat2,0) / DegToRad) * Cos(Nvl(Lon2,0) / Degtorad - Nvl(Lon1,0)/ Degtorad)))); END;

    • By using a select query like, SELECT * FROM USER_LIST WHERE CALC_DISTANCE(MY_LAT,MY_LONG, USER_LAT, USER_LONG) <=5 ; you can fine the list of closest users and display to the user requesting information.

    • This can drain battery and so, it is advisable to not have listing the friends dynamically. Instead the user can have something like 'Find Users' and then your app can list the nearest users.

  2. Getting phone numbers via android app depends on the cellphone carrier and provider. So, we cannot guarantee to obtain cell phone numbers automatically and provide to other user. However, in case you get all the user's cell phone number manually when they first login, this can be possible. The code snippet is however available here Programmatically obtain the phone number of the Android phone. But mind you, in most of Indian numbers, we have observed, this does not work.

  3. That depends on other factors and I am not the right person to comment!

Community
  • 1
  • 1
ngrashia
  • 9,869
  • 5
  • 43
  • 58
  • Thank you very much for this detailed answer :) The third question was because I'm planning to hire a programmer to help me with a project, and since I need to calculate how much money I will spend on this, I need to estimate how much time approximately it will be needed to complete this task. Anyway, your answers to two of my big questions will be very helpful. Thank you again :) – Daniel Muñoz Parsapoormoghadam Jun 12 '14 at 10:07
  • Happy to be of help :) – ngrashia Jun 12 '14 at 10:10
  • A little one more question: you talk about saving the current coordinates in a DB, while the goal is to detect the coordinates in real time. Is it okay that the app saves authomatically the current coordinates of the other phones periodically (for example, every time the app starts up) or is there a better way? The goal is that, for example, when you are walking in the street and you are in the proper distance, the app updates authomatically the list of the phones that are within that radius. – Daniel Muñoz Parsapoormoghadam Jun 12 '14 at 10:34
  • 1
    It is because users might disable GPS in their phone. So, periodically, say every half an hour, the user's last known location, if it is saved, then it will be easy to display. Its upto the architect and the nature of your requirement that decides whether to save in DB and stuff like that. – ngrashia Jun 12 '14 at 10:40