mirror of
git://xwords.git.sourceforge.net/gitroot/xwords/xwords
synced 2025-01-18 22:26:30 +01:00
use slightly different, recommended code to test if network's available.
This commit is contained in:
parent
223909f560
commit
33bccaaf42
1 changed files with 5 additions and 3 deletions
|
@ -73,13 +73,15 @@ public class NetStateCache {
|
|||
ConnectivityManager connMgr = (ConnectivityManager)
|
||||
context.getSystemService( Context.CONNECTIVITY_SERVICE );
|
||||
NetworkInfo ni = connMgr.getActiveNetworkInfo();
|
||||
s_netAvail = null != ni &&
|
||||
NetworkInfo.State.CONNECTED == ni.getState();
|
||||
|
||||
s_netAvail = ni != null && ni.isAvailable() && ni.isConnected();
|
||||
|
||||
s_receiver = new CommsBroadcastReceiver();
|
||||
IntentFilter filter = new IntentFilter();
|
||||
filter.addAction( ConnectivityManager.CONNECTIVITY_ACTION );
|
||||
Intent intent = context.registerReceiver( s_receiver, filter );
|
||||
|
||||
Intent intent = context.registerReceiver( s_receiver,
|
||||
filter );
|
||||
|
||||
s_ifs = new HashSet<StateChangedIf>();
|
||||
s_haveReceiver = true;
|
||||
|
|
Loading…
Reference in a new issue