I've been looking into this for a while and have been unable to find a concrete solution.
I'm trying to detect when a user has started using their internet (3G, Wifi). (Or is about to start would be even better).
Does anyone know if there is an Intent that could detect a person is starting to use the network? What I'm trying to do is run some code once the user starts using their internet regardless of whether or not it is 3G or Wifi.
I've been looking into ConnectivityManager, and Trafficstats() but have so far been unable to come up with a solution. I am not simply looking to see if a connection is available.
One solution that I've been thinking would be to create my own intent but I've been unable to find any good documentation on how to create your own intent filter. (most tutorials I've seen say to use/specify your own Intent, but neglect to say how to create the intent) Because of this, I'm assuming it's something simple that people don't feel is worth mentioning.
The idea behind using an intent was so that I could trigger code to execute on the event that the user is using the internet, not just connected to it. This would be preferable to having a continually executing loop that looks for rx/tx bytes sent out.
If anyone has any ideas and sample code that would be really appreciated.
Cheers