Reputation: 4168
I am new to Android development and I would like to know if there is any way to establish a server-initiated tcp connection on an Android device.
What I'm trying to achieve is making an external server able to access data from the Android phone at any time without using a battery-draining permanent connection.
As it is not possible for the phone to do something similar to an accept()
when it is on 3G, I was wondering if there might be a system of "hidden" notifications that could be used to tell the phone to connect to the server.
Another option would be for the phone to try a connection every X seconds but I don't like the idea, and I'd rather have the connection to be created as soon as it's needed.
Are there any 'clean' solutions to do this?
Upvotes: 0
Views: 294
Reputation: 60276
You may want to have a look at the Google Cloud Messaging for Android.
Upvotes: 2