Android Open Source - cnBeta Network Status Receiver






From Project

Back to project page cnBeta.

License

The source code is released under:

Apache License

If you think the Android project cnBeta listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.

Java Source Code

package com.guest.cnbeta.util;
//  w w w  . ja  va2 s.  c  o  m
import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;
import android.net.ConnectivityManager;
import android.net.NetworkInfo;
import android.os.Looper;

public class NetworkStatusReceiver extends BroadcastReceiver {

  @Override
  public void onReceive(final Context context, Intent intent) {
    
    ConnectivityManager connManager = (ConnectivityManager) context
        .getSystemService(Context.CONNECTIVITY_SERVICE);

    NetworkInfo networkInfo = connManager.getActiveNetworkInfo();
    if (networkInfo != null) {
      if (networkInfo.isConnected()
          && networkInfo.getTypeName().equalsIgnoreCase("WIFI")) {
        if (!Util.threadStarted) {
          T.d("Wifi Connected");
          Thread thread = new Thread() {
            @Override
            public void run() {
              Looper.prepare();
//              ArticleListService cbListService = new ArticleListService(context);
//              cbListService.offLineDownload(context);
            }
          };
          thread.start();
          Util.threadStarted = true;
        }
      }
    }
  }
}




Java Source Code List

.ArticleActivity.java
.ArticleListService.java
.ArticleService.java
.Article.java
.CommentActivity.java
.CommentService.java
.Comment.java
.LoadSourceInterface.java
.LoadSource.java
.MainActivity.java
.PostCommentActivity.java
.Util.java
com.guest.cnbeta.FirstActivity.java
com.guest.cnbeta.SettingsActivity.java
com.guest.cnbeta.database.ArticleDB.java
com.guest.cnbeta.database.BaseDBHelper.java
com.guest.cnbeta.database.BaseDB.java
com.guest.cnbeta.loadsource.BaseLoadSource.java
com.guest.cnbeta.module.Avatar.java
com.guest.cnbeta.service.AvatarListService.java
com.guest.cnbeta.service.BaseService.java
com.guest.cnbeta.util.BaseApplication.java
com.guest.cnbeta.util.DataEngine.java
com.guest.cnbeta.util.FlingGallery.java
com.guest.cnbeta.util.NetworkStatusReceiver.java
com.guest.cnbeta.util.PullToRefreshListView.java
com.guest.cnbeta.util.ScaleAnimationHelper.java
com.guest.cnbeta.util.T.java