F flyingbag Member Licensed User Longtime User Aug 27, 2012 #1 Currently i have the following working fine: - Server side Socket (Java program) running on a linux box : listen mode - Client Side Socket on android device : connects to server - then communication happens as expected (eg send text and echo it back) However: If i want the server to send some message to the android device (when the CLIENT is NOT connected) - what is the best way to do it? (in other words - some kind of "push" notification) - Timer to have client keep connecting to the server at specific intervals (seems inefficient) - Android device can register for some intent that a request is received(is this even possible)? - GCM (seems like one way of doing it - but not sure if this is the only way) - Anything else? Thanks, flyingbag
Currently i have the following working fine: - Server side Socket (Java program) running on a linux box : listen mode - Client Side Socket on android device : connects to server - then communication happens as expected (eg send text and echo it back) However: If i want the server to send some message to the android device (when the CLIENT is NOT connected) - what is the best way to do it? (in other words - some kind of "push" notification) - Timer to have client keep connecting to the server at specific intervals (seems inefficient) - Android device can register for some intent that a request is received(is this even possible)? - GCM (seems like one way of doing it - but not sure if this is the only way) - Anything else? Thanks, flyingbag
Erel B4X founder Staff member Licensed User Longtime User Aug 27, 2012 #2 You will need to better define "most efficient". GCM is probably your best option. Upvote 0
S ScarBelly Member Licensed User Longtime User Aug 27, 2012 #3 I am doing pretty much the same thing in an intranet only environment (so no GCM possible). I am using a service with a timer to poll every 10 seconds and receive short replies (2 to 200 bytes JSON array). I have found both the processing time and power consumption to be negligible. It has been running for 8months and is rock solid. As Erel said: It depends on what you consider efficient. Last edited: Aug 27, 2012 Upvote 0
I am doing pretty much the same thing in an intranet only environment (so no GCM possible). I am using a service with a timer to poll every 10 seconds and receive short replies (2 to 200 bytes JSON array). I have found both the processing time and power consumption to be negligible. It has been running for 8months and is rock solid. As Erel said: It depends on what you consider efficient.
F flyingbag Member Licensed User Longtime User Aug 27, 2012 #4 OK -thanks both. I wanted to make sure before i jump into implementation to see if there is anything i am missing (besides GCM and polling) Also - by efficient i meant how effective a polling implementation would be for process / battery time as opposed to GCM. Looks like you have a neat solution working using polling approach - i might give this a try before looking into GCM... Upvote 0
OK -thanks both. I wanted to make sure before i jump into implementation to see if there is anything i am missing (besides GCM and polling) Also - by efficient i meant how effective a polling implementation would be for process / battery time as opposed to GCM. Looks like you have a neat solution working using polling approach - i might give this a try before looking into GCM...