mirror of
git://xwords.git.sourceforge.net/gitroot/xwords/xwords
synced 2025-01-31 19:57:06 +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)
|
ConnectivityManager connMgr = (ConnectivityManager)
|
||||||
context.getSystemService( Context.CONNECTIVITY_SERVICE );
|
context.getSystemService( Context.CONNECTIVITY_SERVICE );
|
||||||
NetworkInfo ni = connMgr.getActiveNetworkInfo();
|
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();
|
s_receiver = new CommsBroadcastReceiver();
|
||||||
IntentFilter filter = new IntentFilter();
|
IntentFilter filter = new IntentFilter();
|
||||||
filter.addAction( ConnectivityManager.CONNECTIVITY_ACTION );
|
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_ifs = new HashSet<StateChangedIf>();
|
||||||
s_haveReceiver = true;
|
s_haveReceiver = true;
|
||||||
|
|
Loading…
Add table
Reference in a new issue