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
Related
I am developing an android app which is associated with a website so I need a server for website and for web services. I know that the http is application layer protocol that transfer data through either TCP or UDP.
My android app has provision for Google Map for assest tracking.
My GPS tracker (tk-102) sends TCP data (I assume it is raw data without application layer protocol).
Since I will be using a http server for website so can that server accepts raw data (where it is accepting HTTP data) at TCP socket and manipulate it?
if yes then how and do I have any other option for the gps task.
Please suggest a server where I can do this task. I tried searching the net but did not get suitable answer.
You should try using wireshark first to understand actually how your tracker is sending the information. If you can identify the port at which data is being sent you can use iptables to replicate the data and send it to the location of your choice.
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.
I have two android devices that runs a gcm client app. I get the Reg IDs of both the devices. I also have a server API key. Now the thing is, Using a simple php code using cUrl or Zend framework, I'm able to send message from a web server to one of my droids (Of course I can broadcast too). But, with this in hand, is there any way to send a string from one device to another?
Quoting myself from my book:
You might be tempted to use GCM for peer-to-peer messaging, without a server of
your own. In effect, each Android app is its own server, using the same JAR you
might use in a Web app inside your Android app to send messages to some other
party. For example, you could implement a chat system without having a dedicated
chat server.
The danger here is that this would require your API key to be embedded within
your Android application. Anyone with that API key is perfectly capable of forging
messages from you. The IP address restrictions you could place on that API key are
unlikely to help, since your legitimate uses might come from any IP address, not
just some single server. Since finding magic strings in APK files is not that difficult
for those with the inclination, putting your API key in your APK file is a dangerous
move.
Hence, you will want some server of your own as a middleman.
One thing you could do is to make a POST request to your web server with the message and the registration ID of the other Android device, but that would be a little cumbersome as you'd have to figure out a way to retrieve the registration IDs of the other Android devices from your web server.
I would recommend looking into XMPP as this protocol has been built from the ground up to be an extensive messaging protocol. I'm pretty sure you'll find good XMPP server frameworks to implement your functionality.
I am building a mobile device that needs to send realtime information to other devices. I have considered XMPP but I do not have a server, so the communication must be only between the devices.
Is there a way to communicate using XMPP between mobile devices without a server (Or using the mobile devices as servers)?
Is Sockets a good idea ? i.e. Having a ServerSocket and client Socket and communicating this way.
Is there a smarter way? I have heard of jWebSocket but I dont really know how it works or if it's worth it.
EDIT
The process is as follows:
I'm using Parse as a server/backend http://parse.com
When the user runs the app, a user list is retrieved from the parse server
The user then has (Could have) the ip of other clients and then attempt to communicate with them.
Problems
1. Parse does not support a XMPP server or other type of servers
You might look at using an IRC client library like http://jerklib.wikia.com/wiki/JerkLib_Wiki. This way you can use a public IRC server to communicate with your other devices...
I've not used it, but I did bookmark it for further reading because I thought it a novel concept ...
I hope it helps...
I'm using C2DM in my Application to send data from mobile to mobile
But C2DM uses Google server(lacks data confidentiality) to redirect messages to device.
Is there any other way for sending data from mobile to mobile directly without any third party server?
I dont want to use SMS in my App.
Base on requirement (1) Without third party server (2) Between 2 mobiles.
Your options are limited to these:
WiFi Direct (Ad Hoc Network)
http://developer.android.com/guide/topics/wireless/wifip2p.html
Bluetooth
http://developer.android.com/guide/topics/wireless/bluetooth.html
NFC
http://developer.android.com/guide/topics/nfc/index.html
You clearly said "no third party server". But may I suggest xmpp. I've had good luck with smack derived jars and OpenFire. You get a lot of flexible and easy to use functionality out of the box. It may be your best bet for chat type applications.
We host our own instance of OpenFire and authenticate against Active Directory. The XMPP protocol provides the user/device addressing, routing, and, optionally, store and forward capabilities.
It also makes it easy to exchange device data with applications written for other operating systems and in other languages. XMPP IQ packets can be used for lookup type transactions without the overhead of a Chat type connection (no presence information, back end XEP-114 plug ins to connect with server side resources).
Not really: your device has to know which device to connect to. You could theoretically do that if you know the IP of the device, but with mobile phones this changes frequently and I'm not even sure if mobile providers will let you connect directly to devices on their network. So, you're at least going to need a 'step' in between the two phones that you can trust to be stable.
What you could do is set up your own server, and let a user (user1) upload messages to your server addressed to a specific sender (user2). When the message is received, you can use C2DM to send a signal to user2's phone, and attach the message's unique identifier to this. When user2's app receives this message, you can proceed to download the message content from your webserver.
If you don't want to use any webserver at all, you're limited to the options mentioned by Calvin: WiFi, bluetooth or NFC.
Unfortunately having a direct socket connection between mobiles phones is almost impossible as they invariably are behind firewall. BTW also look at https://www.alljoyn.org/ Its an interesting technology as well.