androidwifitraffic3ggprs

How to determine the flow is generated by GPRS 3G or Wifi?


In the flow monitoring program, how to determine the flow is generated by GPRS or Wifi ? Please provide me some ideas and suggestions? Thanks a lot .


Solution

  • You can check to see if wifi is connected by the following

    ConnectivityManager conman = (ConnectivityManager) getSystemService(Context.CONNECTIVITY_SERVICE);
    boolean wifi = conman.getNetworkInfo(ConnectivityManager.TYPE_WIFI).isConnected();
    

    Checking for other network connection types can be done by changing the TYPE_WIFI property.