Ensure that you have the android.permission.WAKE_LOCK
permission and the user has set their Wifi settings to "Never Sleep" in the Android Wifi Manager.
I have verified that ServerSocket
works with the screen off in Android 4.0 in a standard Thread (launched by an Activity) -- I have not tried it as a Background Service. I am able to send commands to my phone every 10 minutes from an external server.
Code snippet for acquiring the Wifi and Power locks, which are both required: