how can I let TCP keep connected, when the android system goes to sleep?

38 views
Skip to first unread message

ken chow

unread,
Jan 11, 2016, 11:51:08 AM1/11/16
to android-ndk
This problem has struggled me for a few days, I have checked so many documents and still haven't found any solutions, BTW, I'm living in china, we can't access any google servers, and NAT is been widely used in our networking environment, and for some reasons I chose JNI and C to implement my program.

android system version: 5.0
connection method: WIFI, no SIM card

I set up a TCP socket via C in a fork() child process for send msg to remote server every 2 mins, and call by java as program's entry, when the android phone goes to sleep, my socket stop sending packet, then I push power button, the socket start working.

so, 
1. how can I let TCP keep connected even the android system goes to sleep?
2. I know if we keep AP(Arm processor) will waste a lot unnecessary batteries, so can I move my program to BP(bandbase processor)? I'm not sure this is a feasible idea.
Reply all
Reply to author
Forward
0 new messages