Home | History | Annotate | Download | only in monitoring-device-state
      1 page.title=
      2 parent.title=
      3 parent.link=index.html
      4 
      5 trainingnavtop=true
      6 
      7 previous.title=
      8 previous.link=docking-monitoring.html
      9 next.title=
     10 next.link=manifest-receivers.html
     11 
     12 @jd:body
     13 
     14 <div id="tb-wrapper"> 
     15 <div id="tb">
     16 
     17 <h2></h2>
     18 <ol>
     19   <li><a href="#DetermineConnection"></a></li>
     20   <li><a href="#DetermineType"></a></li>
     21   <li><a href="#MonitorChanges"></a></li>
     22 </ol>
     23 
     24 
     25 <h2></h2>
     26 <ul>
     27   <li><a href="{@docRoot}guide/components/intents-filters.html">intent  intent </a>
     28 </ul>
     29 
     30 </div> 
     31 </div>
     32 
     33 <p></p>
     34 
     35 <p> {@link android.net.ConnectivityManager} </p>
     36 
     37 
     38 <h2 id="DetermineConnection"></h2> 
     39  
     40 <p> {@link android.net.ConnectivityManager} </p>
     41 
     42 <pre>ConnectivityManager cm =
     43         (ConnectivityManager)context.getSystemService(Context.CONNECTIVITY_SERVICE);
     44  
     45 NetworkInfo activeNetwork = cm.getActiveNetworkInfo();
     46 boolean isConnected = activeNetwork.isConnectedOrConnecting();</pre>
     47 
     48 
     49 <h2 id="DetermineType"></h2> 
     50 
     51 <p></p>
     52 
     53 <p>WiMAXWi-Fi </p>
     54 
     55 <pre>boolean isWiFi = activeNetwork.getType() == ConnectivityManager.TYPE_WIFI;</pre>
     56 
     57 <p> Wi-Fi  Wi-Fi </p>
     58 
     59 <p></p>
     60 
     61 
     62 <h2 id="MonitorChanges"></h2> 
     63 
     64 <p>{@link android.net.ConnectivityManager}  {@link android.net.ConnectivityManager#CONNECTIVITY_ACTION} ({@code "android.net.conn.CONNECTIVITY_CHANGE"}) </p>
     65 
     66 <pre>&lt;action android:name="android.net.conn.CONNECTIVITY_CHANGE"/></pre>
     67 
     68 <p> Wi-Fi </p>
     69 
     70 <p></p>
     71