server client application in android - 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 ?

Related

Use android phone as a server

First of all i am new to Android programming with no previous experience in server side programming. I am developing an app that works as a cashier for restaurants. The restaurant may have one device working as a cashier for take-away customers and one or more devices in every hall he has for indoor customers. Instead of having one local database for every device in the restaurant i need to have only one centralized database which every device can use.
Can i share only one copy of local databases to all other devices via api or so to achieve this??
If not what alternative options do i have since as i stated earlier i have no previous experience in setting up a server myself??
Recommended method: Setup a server and create APIs to share and store data in your server's database.
An other way to get around the problem: You can use the Firebase to store your data on cloud. In this way all of your devices can share a cloud database without having to setup a server.

MQTT Unique Topic Format generation for Mobile Devices

Currently I'm working on the MQTT based Chat application where I need to assign
Unique Topics to Users dynamically.
So, I thought of using their IMEI/MobileNumber. But in iOS, we cannot get the IMEI Number so we thought of generating a random IMEI from the backend and assign it to the Users.
Now, My problem is whenever user changes his mobile, the IMEI Number changes and it will be fresh profile again to that user.
If I use based on his Mobile Number, there is a chance when the user doesn't use the sim for 3 months. The connection automatically terminates from the network provider and the same number will be assigned to another new customer(atleast here in india).
Can anyone suggest me a good approach for the Topic Generation?
BTW, I need a Web Chat also and that need to be fetched from database. that is the only reason, I'm focusing on the Topic Generation. So, I will fetch messages based on his topic and show them in the Web Chat.
Do anyone know, how whatsapp maintained their topics?
I thought of using their IMEI/MobileNumber.
Bad design. Have the user create an account (i.e. email) with a password for your service that way no matter what phone or phone number they have, they can still log in and use your app. And make sure you ENCRYPT the user credentials in your database. Start FIRST by building an app with proper security or else you will be hacked 5 minutes after you launch it.
Do anyone know, how whatsapp maintained their topics?
Just because Zuckerberg copies everyone else, doesn't mean you need to copy them. Also, I believe whatsapp created there own version of a MQTT Broker. Hence, it will have an entirely different set of functionality from a regular MQTT Broker.

Android - Sending and receiving location updates of other users

I have already an location based app which functionality i want to expand:
A user can login to this App via Facebook and also other users are logged on their own Mobilephone. Both can see the location of the other.
So basically an location aware meet people APP :-)
How can I do this? Backend with PHP and mysql database?
Are there already existing solutions I can use?
Tutorials available describing this?!
the infrastructure you need is achievable in many many programming languages and many types of databases.
In the end what you need is a server running that can store the location data sent from the users. Ideally i would tell you to use webservices in order to achieve this.
Next, you will need to implement a location service app that works on the user smartphone and uses the web services to send information and get information to and from the server.
Programming languagens you can achieve this are so many. For example, in the back end you can use a mysql database with a tomcat server. if u need a front-end for the server you can use java server pages, php, whatever u feel more confortable with.
for the mobile phone there are hybrid application for different OSs. for android specifically you will use java. if u want to save some info in the phones you can use a SQLite database. this is important if you want to send data only when internet connections are available.
Those are the kind of things you have to deal with. Hope i helped you.
Good luck.

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

How to get credibility of a messages author in a local p2p network without the use of accounts stored on external servers?

Hello I am developing an application that will exchange unique groups and messages belonging to them between peers within a local network without any servers. Each of the peers should be able to create a new message and associate it with an existing or new group. Since messages and groups should be unique I have implemented a hash algorithm creating the ID of those messages from static values like, content, date of creation, author, title (messages are not editable). The ID I am using is helping me check the integrity and possible duplicate when the message/group is sent to another device. But since there is no server to store accounts and check for credibility of each of the peers I cant think of a way to implement a mechanism that will check whether a given message is genuine from a specific author. At the moment anyone can publish messages adding a false author name, which is something I want to resolve. How can I do that?
PS. My application might be similiar to how Twitter works but it has no accounts and no main servers to store them. It is developed on android and it cannot use the internet simply because it is using wifi to connect to LAN only routers and I wouldn't want the users to have to use 3G/edge.
Possible solutions:
Use the phone's special ID (IMEI) , but also how do I get that programatically and is it really unique?
Use MAC Address of the phone (actually hashed concatanation of Bluetooth and WiFi MAC Address), is that unique per phone?
The problem with this and the above is that the genuine author might change his phone over time.
If the genuine author has logged on with his Google Account previously is it stored in the phone's memory and can I programatically get this information in offline mode?
The use of Digital Certificates to sign messages could also be a solution. Although its use may raise some more questions like "Who's the issuer?". Well, it could be an "entity" created by you if the authenticity of the messages are only important inside your own application.
Just something to consider if you haven't already.
I don't think you can do anything about a false name, but in most cases fake names are okay - what you want to protect against is one user posing as another. Digital signatures would be the way to go - ensure that everyone has a randomly-generated secret they can use to sign all their communications.
For mobile-based comms, you could go one step further and get people to certify they know another person, using short-range communications. For example your app could do a Bluetooth exchange with another phone, and that would modify each profile to say "trusted person X certifies they have met untrusted person Y". Since it would require the consent of both parties, if one party is trusted, the other one likely can be too. The short-range comms would ensure that the parties have met (and perhaps are certifying that a person is like their profile picture).
You could also do a similar thing to Gravatar - use a hash of the name and the secret to choose from a wide range of avatars (or, generate a random image using a very long hash). This way, two people posting under the same handle will have very different avatars, and they can easily be told apart by the user community.

Categories

Resources