Real Time Tracking in Android App - android

How does app like Uber do real time tracking of Cabs? Let me put it across in detail:-
Cabs Position to the server.
Server then communicates that positionto the another user app which is trying to book a Cab.
I have gone through many blogs, after that I could think of the solution below to solve the 2 issues:
Cabs will communicate there lat/long to server after some time gap using http request.
The user app will establish a socket with the server and any change in the server will be communicated to the user app through that socket.
Is there a better way to do it? Please give your insight about the issue.

i think each cab will be fitted with a GPS tracker(could be mobile based app also NOT SURE) to track and send real time data, once the location data changes a TCP connection established will be used to communicate.

I have the same issue here for my app, where drivers send their locations in a MySQL table in a server.I think the best way to do this is WebSockets, to create a connection between the server and client and send the new location everytime when changed.
I really don't know if is the best approach but i will try to do this, maybe can help you also.
I'm using PHP so i will try with Ratchet:
Ratchet PHP

I think cabs do not communicate to the server or vice versa, until there is some client/passenger who pin his location and destination. The request of client is sent to the server, then server looks for the cab that is closer to the client/passenger. There is quite possibility that they are using GCM Google Cloud Messaging Service of google.

Related

Which is best solution for p2p connections

I'm thinking develop android application,Where is s/he?.
If client 'A' request location of client 'B',Server connect client 'B' and get gps location of client 'B' and server response to client 'A'
Application should work in background but should not force hard to mobile device.
There should be no trafic between client and server if there is no request. Traffic should be if there is request.
Like Skype or whatsup,you can connect client everytime you call or sending message If client is on internet so that my application should work if both users on internet. İf requested client is not on internet then application should send latest known position.
For these porpose,Which protocal should I use? Http(I think no),TCP ,XMPP or android bound service implement my methodlgy?
How do I implement my applcations methods?
thanks
I do not want to offend you, but I think you should start with the fundamentals of android development and distributed systems.
However, here is my answer:
You could use HTTP, but better use HTTPS to be sure, that data is encrypted between the server and the client.
If I were going to create such an app, I'd write a small application on the android device which transmits the position of the device, together with a unique id of the device (probably the IMEI) to a server, encoded in a HTTP(S) request.
Using HTTP would have the benefit, that you could use many different languages on server side, for example PHP (would be my choice, but you could use others).
On the server side you would need to put the recieved data into a database or some other storage.
From there it is your choice what you are going to do and how to present the data. Maybe making a small website?
Regards
Me

Connect Android app to a webserver

Some advice comrades, am thinking of developing an android app that retrieves some updates from a website. In other words when content of the website is updated the app content is also updated. I have searched google and i can't get clear answers on how to do it. Anyone tell me what do i need to do to accomplish this task. I have read about json parsing and web services but everything is not clear since am new to network apps.
If your server is a standard http server, you'll need another server that can establish a connection with the android device.
You can implement it yourself (using TCP or UDP), or you can use the trusted Google GCM:
https://developer.android.com/google/gcm/index.html
I recommend using GCM, but in either way, you'll have to make your current server, to notify the other server when it needs to send a message to any device.

how to sent my current latlong to other user?

im creating an application i want to sent my current lat long to other user using any service but i dont have any server side application i have only user side application how i will sent my lat long to other user which use same application with out using any server? what do ido??
how to sent my current latlong to other user?? without using server url
i just simple want to sent my current latlong to other user he also use same application
You might have several possibilities. One of them is creating a Socket from one to other. This has the disadvantage that you need to know the destination IP address, which in turn raises other problems: Several mobile ISPs in some countries assign the same IP address to several mobile devices, if the user's using WiFi, you might crash into some Firewall problem.
Another way is via Bluetooth. This, however, needs the two devices be fairly close to interchange the information.
Summarizing: The best way is indeed using a third-party server somewhere in the internet and use it as a web-service, that's the best way how you can change information between devices.
You send it via SMS. Another end user app have to read the incoming SMS, Which is related with latlong they can update them UI
You can use sockets
http://developer.android.com/reference/java/net/Socket.html
Implement a ServerSocket in one side and connect to it in the other side, devices should be connected over the Internet of a wifi network
You can use a Third party server and GCM. Register all your users to The third party server, then send your LatLong to the server which will relay it to the user identified by the GCM registration ID

Android server request listener

I'm trying to find a solution to listening for a request from a server.
The server would send a String to the phone, based on the ip address of the phone and the android app would take action when it happens.
Has anybody here faced a simular problem and can direct me to an example on the web or something?
Thanks
You can use sockets for it. See here and here.
You can't really be sure of a mobile device's IP address. It can change as you switch between WiFi hotspots, or as you move to a different 3G area. For this to work, the mobile has to register somehow with the server. The usual way to implement it is to keep an open connection, where the server responds with data only when it wants to notify the client. It is possible to create your own implementation, but not trivial. Android has a standard way to do this called Cloud to Device Messaging (C2DM). It is used by GMail and other Google apps, so it's fairly reliable. There are other services that provide something similar, you might want to look into those if C2DM doesn't fit your needs (it requires a Google account, etc.)

server client application in android

I am trying to develop an application in android in which users will be able to share their location information with other users they choose. Firstly i tried to make it a database driven application but it was a bit though for me .
Now i decided to make it client server application in which there will be one server and multiple clients. When the client opens the application, it will connect to the server over TCP. The server will keep track of which users have connected. Then when a client user want to share its location information, it will able select among these list (list will be passed to the client by the server.)
but with this approach i have this issue:
how can i track or keep each user's unique info on the server. One solution maybe is to use the i.p. numbers, but there maybe multiple clients connected through same i.p. for example from a campus network. (my system will be tested in such a network).
Any help will be greatly appreciated.
One possible solution could be this...
Create a registration form in your android app. You can ask them to enter their cell number (which will be unique) or you can fetch IMEI number of the device and store it in server using an SQL OR NO-sql db (Raven, Mongo, couch etc). and using it as a unique key you can keep track of all the clients...
did i miss something ?

Categories

Resources