-2

I am developing an android app for mobile device management system - which needs to mainatan a persistent connection to a web server through https connection and wait for any commands from the server. Can some please help me in the design of this app? Below are few of the question I had:

  1. I am planning to create an intent service which opens a https connection and making it persistent by setting the connection property as : conn.setRequestProperty("Connection", "keep-alive"). Will this guarantee a persistent connection?

  2. How can the app receive commands from the server execute them and respond back to the server. A simple command for execution could be to "fetch device info". Once the server sends the command, the app should fetch basic device info and reply back with a JSON object.

  3. After the response, does the connection close? Or will it remain opened? I want it to remain opened to receive the next command from the server.

Any suggestions/pointers would be deeply appreciated!

Thanks.

user2230637
  • 19
  • 1
  • 5

1 Answers1

0

Use Firebase Cloud Messaging don't make your own persistent connections. I guess I answered all of your questions.

MRazian
  • 88
  • 1
  • 13
M-Wajeeh
  • 17,204
  • 10
  • 66
  • 103
  • Due to some constraints I cannot use the Google Cloud Messaging. Can you please suggest some other alternatives? – user2230637 Jul 19 '13 at 16:41
  • I can not think of any single reason or constraint that is stopping you from using GCM, anyways whatever you do, don't try to make it work manually, you have to use some push service. one google search gave me this https://parse.com/tutorials/android-push-notifications. – M-Wajeeh Jul 19 '13 at 16:52