Win a copy of The Business Blockchain this week in the Cloud forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

What will be Best Approach to connect a Android App with Server

 
Kishor Joshi
Ranch Hand
Posts: 674
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi There

I am working on a Multi User Messaging App in Which Users can message to Each Other and also Group Messaging and Synchronization of data between Android app and Server is there.

I Just Want to know what are the approaches there should be and what could be Best?

I have heared about GCM(Google Cloud Messaging),Using Socket Programming...

any Suggestion or a guide API link to read more?


Thanks
 
Ulf Dittmer
Rancher
Posts: 42969
73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Haven't you asked the exact same question a few days ago? As I recall, you were satisfied with the answers you got then. So you should clarify how what you're asking now is different.
 
Kishor Joshi
Ranch Hand
Posts: 674
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Ok I want to know.

How I can connect more than one Android Client to Server so that all their chat messages are Synchronise with Server and they can also view who is online?Instant messaging and Group Chat?


I have found many things like Google Cloud Messaging for Push Notification and Socket Programming(Like We make Chat Application in Java).

What approach I should use a High level description what technology for which task?

Just a High level overview which one is best for Multi User messaging environment?
 
Ulf Dittmer
Rancher
Posts: 42969
73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
A REST API is a good way for the app to send data to the server (like a new chat message) or request data from it (like the list of all users that are online). GCM is a good way for the server to send data to the client (like the notification that there is a new chat message). The functionalities you mention would be implemented using these communication forms.
 
Kishor Joshi
Ranch Hand
Posts: 674
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Ok

Can I use Socket Based Connection for this purpose for one Server and More than one Client?

If yes please explain how this is best from REST API and if no why?

Any Reference or Document will be nice
 
Ulf Dittmer
Rancher
Posts: 42969
73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
A REST API would use HTTP - which is a higher level protocol that uses sockets. If the question is whether you should use sockets directly, then the answer is no.
 
Kishor Joshi
Ranch Hand
Posts: 674
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Ok
How Can I Test this application on Localhost ?
Such that two Android app o different Emulator are connected with Each other By a 3rd Party Application Server.

And they can see the List of user avaiable online and all
?

How they can Exchange message?

Finally I want that This app will run on a 3rd Party application Server.Where all data are stored is stored.And User can chat Using Internet.But a Server is between them To store their Basic Infromation.


 
Ulf Dittmer
Rancher
Posts: 42969
73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Android apps running in the emulator can connect to a server running on localhost via a special 10.x.y.z IP address. I forget what it is, but a search will find it quickly.
 
Kishor Joshi
Ranch Hand
Posts: 674
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Ok I know it is 10.0.2.2

So I decided the architecture all users of app are registered on a 3rd party application server.

Each time when a User want to send some msg to other user first this msg will go via server to that user

I will use GCM(Google Cloud Messaging) for Notification purpose.

But I Have one question Each time when request will go through server then who will receive that request? a Servlet?

If there are more than One Users like 10 users(Or More) chatting with each other how that servlet(or else who held request from some to other user toother) handles all these requests ?
do i need Multi-Threading here(I think no servlet use Thread approach)?


I also want to know If you have experience in working these type of Multi User Applications can you share your experience what seneraio I need to consider not from my academic prospective but like a Real world application like(Encryption,Spyware,Intruding... and so on)
 
Ulf Dittmer
Rancher
Posts: 42969
73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Servlets are a possibility, but I'd consider REST WS first. You generally don't need to worry about concurrency because the servlet container (and/or REST implementation) handles that for you.

As to what needs to happen if user X sends a message for user Y or user group Z - that's for you to implement.

As to security - yes, you should use encryption. HTTPS is likely sufficient, unless you have other requirements. Not sure what you mean by the malware comment. For every publicly run app you need to do a risk assessment to determine who might attack it, and how. Then you need to decide what steps to take to mitigate those risks that you
have determined need mitigation.
 
Kishor Joshi
Ranch Hand
Posts: 674
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have one confusion

I have worked on Many Projects that a Client-Server architecture.

But I have not worked on any Client-Server-Client architecture project.


So My Question is if User X wants to send Msg to User-Y then what will be role of Rest WS in this to connect each one in them.?

One Approach is If User-X wants to send a Msg to User-Y then User-X first send "Msg" with "Id of Another User-Y" to Server then Based on That ID Server will decide Which User To send Msg with that Id.

Will this be good(not best)?

 
Ulf Dittmer
Rancher
Posts: 42969
73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I don't see a difference between client-server and what you call client-server-client. The server takes action based on client input - what difference does it make what that action is?

What you describe is not "good" or "best" - it's what needs to be implemented. I can't help but feel that you're seeing complications where there aren't any.
 
Kishor Joshi
Ranch Hand
Posts: 674
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Ok Thanks

I got what I want
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic