Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

android Wifilock- How about mobile data access lock?

If there's a wifiLock for acquiring wifi and enabling it to work even when the phone goes idle and sleep, is there happened to be a counterpart of it for mobile data access?

You see, everything goes well now if the user is in wifi connection. But somehow, using mobile data access, and when the phone goes idle, it seems to be dropping the connection. Any ideas?

like image 833
lorraine Avatar asked Nov 18 '12 13:11

lorraine


1 Answers

Mobile data does not go to sleep. However, if your socket remains open and unused for a while, it may get shut down. That's why C2DM (and, presumably, GCM) had to send a heartbeat every 30 minutes or so, to make sure the open socket connection to Google's servers remained open.

like image 58
CommonsWare Avatar answered Oct 06 '22 00:10

CommonsWare