Android Open Source - cnBeta Network Status Receiver

From Project

Back to project page cnBeta.


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.os.Looper;

public class NetworkStatusReceiver extends BroadcastReceiver {

  public void onReceive(final Context context, Intent intent) {
    ConnectivityManager connManager = (ConnectivityManager) context

    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() {
            public void run() {
//              ArticleListService cbListService = new ArticleListService(context);
//              cbListService.offLineDownload(context);
          Util.threadStarted = true;

Java Source Code List