finding latitude and longitude of android mobile using its number - android

i am trying to develop an android app (named ContactListFinder) which follows the following steps
access contact list through android.provider.ContactsContract package
access phone number likewise
calculate the location of the sender and receiver in terms of lattitude and longitude and then find the distance between sender and receiver
pop a message if within coverage area otherwise no message is displayed
Now here the problem is "finding location using mobile number in terms of longtitute and latitute"
Any suggestion is welcomed.

"Finding location using mobile number in terms of longtitute and latitute" is, by definition, impossible. I have the same phone number everywhere on the planet, because I do not change my SIM card when I travel (domestically or internationally), and I am set up for international roaming.
"Finding location using mobile number in terms of longtitute and latitute, for people who use some sort of 'check-in' service to allow people to know where they are at all times, despite the fact that this sort of opt-in panopticon is truly frightening" may be possible. You would need to find such a service that has an API that allows you to find the location of arbitrary people by phone number. And, you would need both sender and receiver to use one of these services. And, you would need to ensure that your use of these services do not violate any privacy policies or other terms of use.

Nice app,you can find user location(longitude,latitude) not by phone number but you can find it using android location-based services provided by LocationManager class.So, you cant access user friends location unless they have app installed.so, you may have to create user community using your app and maintain central database containing all users location information.Hope this will help.

Related

Can I fetch the data being given to an app by its host and store it locally?

I would like to preface my query by saying that I am an absolute beginner when it comes to programming but I really want to realise this project so every little help is deeply appreciated.
I am trying to build an app that needs accurate train data for it to work and from my current research as there is not central government API for railway data , the only accurate data source for train location that I can find is in an other app that uses crowd sourcing to pinpoint the location.
I wanted to know if it is possible to fetch that train data from that app and then use it on my own as it would make my app a lot more reliable and accurate.
The issue currently is that the app only shows graphical representation of the data thats being fed to it from its servers , so I wanted to know if there is a way to access the actual data being sent to the app.
Thank you.
Let me clarify, this is a very broad question and hence will have a very broad answer too.
As far as I can understand from your question is that you want to show TRUE location on a map.
For this, you will have to understand the complete Tracking scenario. Let me explain it to you step-wise below:
There is an app, installed on a device (user) which fetches the GPS location (REAL) data and keeps sending it to a server (backend).
This GPS data is the Lattitude-Longitude coordinates of the device (user).
The server stores this information in their database for queries.
There is another user, different than the one currently sending the location data, who wants to know the location of the first user. The app which he is using will request the server (backend) to send the location data for the device. Which, in turn, will send the latest location data (LatLng coordinates) to the current app. This app will then show the location data over a map.
Now, usually, this process is followed to show one-to-one location data. However, in scenarios like Train Location etc, servers usually collect pool of location data, being received from several users, to cross-verify the actual location (average out, mean, location optimization algorithms etc.) and then display that information over a map.
As per your requirement, which I can understand, you want to get this REAL data directly from either another app or from the server. If you want to get the location data from the server, you will need an API, which serves as a Request-Response platform. However, if you are looking to get the data from another app, it would rather be simpler to get the location data directly, as your APP will also be installed on the device itself.
I would suggest you to kindly read about getting and processing location data, communication with servers over API etc for better understanding and implementation of your requirements.

Making a Android chat app and finding people nearby

Hi everyone I'm in trouble one of my friends asked for a chating Android app which it could find "People Nearby" using this app and first I said yes I can make it but now I'm unable to do.
so It's my very first app that I'm making it for someone I wanted to know if "People Nearby" is simple function for an app or it's complicated and hard to make it
I've seen this kind of apps like swarm that shows you people nearby
but unfortunately I can't find any help or source or tutorial for it the only thing I could find was Google's Nearby Messages which I'm not sure that's what I'm looking for
so I would be very happy if you could help me or at least tell me where I can find a help.
Server side:
(You can use python flask for this kind of simple requirement If you do not have experience in server side scripting)
Your API's must have.
/register -> Registering user profile (unique id, name, location etc) and save it in database.
/receive_location -> Receive location (lat lang values), update in the user profile and check with all records in your database who is in the radius(defined by you or get this as from user) and return the list of user details to client.
Client side:
Have an IntentService which will post location of the client to the server at certain intervals returns the list of users who are in the radius you define.
User googleApiClient to get the location and server .
http://developer.android.com/training/location/retrieve-current.html
Use recycler view to show this result. Send a local broadcast from intent service to tell the activity containing recycler view to update it.
Basic requirement for this is you must have server where all user data is stored.
You must have all users updated latitude and longitude.
To get updated latitude and longitude you must call your api at periodic times.
If you want nearby people search you must call api with your current latitude and longitude, then from server and your api must filter all users location and gives you nearby people.

How does mobile application find users nearby

I am working on an android application which can find users nearby.
I need help in design that application.
I am thinking:
1. When I start my application, I use API to find my location.
2. I send that location to my server.
3. server returns a list of other users nearby.
My question is how can the server keeps track of a list of users who are nearby?
Do I create a background service on phone who will report users location periodically?
And the server maintains a list of all users' location?
Is that approach feasible?
You're on the right track. If you are able to geocode or retrieve your current location lat/lon coordinates, there might be a library that can help you out.
My first thought was the Geocoder (https://github.com/alexreisner/geocoder) library for ruby, it offers a slick API that allows you to easily find other nearby objects:
if obj.geocoded?
obj.nearbys(30) # other objects within 30 miles
obj.distance_from([40.714,-100.234]) # distance from arbitrary point to object
obj.bearing_to("Paris, France") # direction from object to arbitrary point
end
There are other options that are easy enough too, if you're using PostgreSQL with PostGIS, you have some utility functions that I'm sure you could use to query 'nearby' users. (Found an example, "What is the best way to find all objects within a radius of another object?" http://postgis.net/docs/manual-1.3/ch03.html#id434832)
So the overall workflow would be:
Request lat/lon from device API
Send lat/lon to server/web service
Use library/database to find other users within a specified radius
Send list of users back down to device
I suspect the most difficult aspect would probably be keeping the lat/lon of other users up to date, but that's a different problem to solve.
Edit:
Just to clarify, you'll definitely want to store all the logged in users' lat/lon inside of some sort of database on the server. It's a very feasible approach, but you'll have to keep it up to date and be able to determine somehow if the data is stale (if that's important to your application). Whether you use a background service to keep that information up to date is kind of up to you and the constraints of the problem you're trying to solve.

How to get the name of the nearest city

I have some app that sends some information to the internet from time to time let say ones at day. And I can easily send some coordinates (using the gps position) but I do not want that. The android phone is always connected to the internet via wifi or mobile network. But not always enabled the gps. So is it possible to get the location with wifi or mobile network ? I google this thing and I end up with finding location by gps, I do not want to do that.
Can you give me some ideas what can I do this. I have seen web sites that when I open them they know where am I, so I guess it is possible to find the nearest name of the city just by making a internet request and reading the response or maybe use some service . . .
Thanks
http://developer.android.com/reference/android/location/package-summary.html
http://developer.android.com/reference/android/location/Address.html#getAddressLine(int)
getLocality looks like it may do what you want?
For websites that know where you are, they either use your source IP and look that up (which isn't very reliable for a lot of things), or they use the javascript geolocation APIs as described here:
http://merged.ca/iphone/html5-geolocation
In fact, here's a stack overflow answer on using google API to get to the city name:
Get city name using geolocation

android send location details to servlet via gps

i am newbie to Android..i have latitude and longitude details in my program..i want to send them to web server via gps..and those details should be saved in a database and retrieve them whenever i require..plz explain me how to do..and if possible give me some sample code...
Did you mean the mobile network or wireless instead of GPS ?
Anyway:
You from the sounds of it you need to get the GPS details into your program then pass them to your server. Have you designed your webserver yet or are you going to be submitting this to a site that already exists?
You can't "send" something "via GPS". GPS is a "receive-only" thing.
http://en.wikipedia.org/wiki/Global_Positioning_System
If you like to send data to a web server, you can use the HTTP-protocol with Android, e.g. retrieve latitude and longitude (How to get Latitude and Longitude of the mobile device in android?) and then use HttpGet (or HttpPost):
http://developer.android.com/reference/org/apache/http/client/methods/HttpGet.html
You're really asking for a lot, but lets see if we can point you in the right directions.
Here is a great example of reading GPS data from an Android device:
LocationManager example
You must declare explicitly in Android that your app needs permission to access the Internet (and the GPS, for that matter).
Android Securty and Permissions
There are also some specific ways of life in Android development. The official developer's guide is a good place to start.
The Android Developer's Guide

Categories

Resources