Android - native sockets that do not remove 3G standby on first try

I have a very nasty problem. It happens that I have an application that uses its own sockets to transmit data over TCP. When I first launch my application and send data through sockets, nothing happens. However, if I then exit the process and restart it and then submit it again, it works. The same thing if I open a browser or something else before starting my application for the first time after hibernation.

How do I get 3G to wake up before I call my own code?

EDIT: I already tried with PowerManager.

+7
source share
2 answers

Try calling startUsingNetworkFeature (int networkType, String). In ConnectivityManager and wait for its availability before you bind your socket ect ......

Android Documentation

0
source

I would ask the ConnectivityManager API requestRouteToHost(int networkType, int hostAddress) .

0
source

All Articles