Project

General

Profile

Feature #221

Utiliser le ConnectitManager

Added by Frédéric Barthéléry almost 15 years ago. Updated over 14 years ago.

Status:
Closed
Priority:
Normal
Assignee:
Category:
Conception
Target version:
Start date:
11/26/2009
Due date:
% Done:

100%

Estimated time:
Close

Description

Ca serait bien d'utiliser le ConnectivityManager du telephone afin de savoir si on acces ou non a une connexion, avant de lancer une tentative inutile.

Usefull Links :

#1

Updated by Nikita Kozlov almost 15 years ago

Petit exemple d'un autre projet ...

       public static boolean isWifi() {

        WifiManager wm = (WifiManager) mContext
        .getSystemService(Context.WIFI_SERVICE);
        WifiInfo wi = wm.getConnectionInfo();

        if (wi != null)
                Log.i("SipUA:", "isFast() " 
                        + WifiInfo.getDetailedStateOf(wi.getSupplicantState())
                        + " " + cellAsu);
        if (wi != null
                && (WifiInfo.getDetailedStateOf(wi.getSupplicantState()) == DetailedState.OBTAINING_IPADDR || WifiInfo
                        .getDetailedStateOf(wi.getSupplicantState()) == DetailedState.CONNECTED)) {
            on_wlan = PreferenceManager.getDefaultSharedPreferences(mContext)
            .getBoolean("wlan", false);
            return on_wlan;
        }
        on_wlan = false;
        return on_wlan;
    }

    public static boolean isUmts() {
        TelephonyManager tm = (TelephonyManager) mContext
        .getSystemService(Context.TELEPHONY_SERVICE);

        if (!PreferenceManager.getDefaultSharedPreferences(mContext)
                .getBoolean("3g", false))
            return false;
        if (tm.getNetworkType() >= TelephonyManager.NETWORK_TYPE_UMTS)
            return true;
        return false;
    }

    public static boolean isEdge() {
        TelephonyManager tm = (TelephonyManager) mContext
        .getSystemService(Context.TELEPHONY_SERVICE);
        if (tm.getNetworkType() == TelephonyManager.NETWORK_TYPE_EDGE)
            return cellAsu >= minEdge;
        return false;
    }
#2

Updated by Frédéric Barthéléry almost 15 years ago

Nikita Kozlov wrote:

Petit exemple d'un autre projet ...

[...]

Peut etre enormement simplifier vu que nous on veut juste savoir si il y a du reseau.

#3

Updated by Nikita Kozlov almost 15 years ago

yep, c'était juste un bref copier/coller.

#4

Updated by Nikita Kozlov almost 15 years ago

  • Assignee set to Nikita Kozlov
#5

Updated by Nikita Kozlov almost 15 years ago

  • Status changed from New to Feedback
  • % Done changed from 0 to 100
#6

Updated by Nikita Kozlov almost 15 years ago

  • File installsamba4.sh added
#7

Updated by Nikita Kozlov almost 15 years ago

  • File deleted (installsamba4.sh)
#8

Updated by Nikita Kozlov almost 15 years ago

  • File new.patch added
#9

Updated by Nikita Kozlov almost 15 years ago

  • File deleted (new.patch)
#10

Updated by Frédéric Barthéléry almost 15 years ago

  • % Done changed from 100 to 90

Je pense que ca devrait plutot etre fait dans le service et non dans l'ui.

#11

Updated by Nikita Kozlov almost 15 years ago

  • % Done changed from 90 to 100

Add of an Intent receiver in the service.

#12

Updated by Nikita Kozlov over 14 years ago

  • Status changed from Feedback to Closed
#13

Updated by Frédéric Barthéléry over 14 years ago

  • Target version changed from 0.2 to 0.1.3

Also available in: Atom PDF