Not exactly what you ask for but this is how I do it.

I'm not trying to be specific about the speed in kbs of the connection
because it can change a lot due to the user moving from cell to cell.
So I simply detect what kind of mobile connection we are on and send a
slow connection warning only when connected via EDGE or GPRS.

Here is the code that returns true if the connection is a slow one :

        public boolean internetConnectionIsLowSpeed() {
                ConnectivityManager connec = (ConnectivityManager)
getSystemService(Context.CONNECTIVITY_SERVICE);

                if (connec.getActiveNetworkInfo()==null) return(false);


                if
(connec.getActiveNetworkInfo().getType()==ConnectivityManager.TYPE_WIFI)
{
                        return(false);
                }

                if
(connec.getActiveNetworkInfo().getType()==ConnectivityManager.TYPE_MOBILE)
{

                        switch(connec.getActiveNetworkInfo().getSubtype()) {
                                case TelephonyManager.NETWORK_TYPE_GPRS : 
return(true);
                                case TelephonyManager.NETWORK_TYPE_EDGE : 
return(true);
                                case TelephonyManager.NETWORK_TYPE_UMTS : 
return(false);
                                case TelephonyManager.NETWORK_TYPE_UNKNOWN : 
return(false);
                                default : return(false);

                        }
                }

                return(false);
        }

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Reply via email to