Android Open Source - hts-cycle Wifi Handler

From Project

Back to project page hts-cycle.


The source code is released under:

GNU General Public License

If you think the Android project hts-cycle 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 it.uniroma2.wifionoff;
//from   ww w.  ja  v a 2  s  . c o  m

import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;
import android.content.IntentFilter;
import android.os.PowerManager;
import android.os.SystemClock;
import android.util.Log;

public class WifiHandler {

  static private WifiHandler single_instance=null;
  final static String LOGTAG="WifiHandler";
  private WifiManagerNew mWifiManagerNew;
  int secondstart;
  int minutestart;
  Context ctx;
    private WifiManager mWifiManager;

    public void startall(Context arg0){  // TODO Auto-generated method stub
      //aggiungere variabile globale per sapere se stiamo parlando o no
      mWifiManager = (WifiManager) arg0.getSystemService(Context.WIFI_SERVICE);
       mWifiManagerNew = new WifiManagerNew(mWifiManager);


           final IntentFilter Filter = new IntentFilter();
         ServiceCall ser = new ServiceCall(arg0);
         arg0.registerReceiver(ser.MyReceiver, Filter);
        Log.w(LOGTAG,"MyReceiver Registered");
         final IntentFilter FilterS = new IntentFilter();
         arg0.registerReceiver(ser.netReceiver, FilterS);
        Log.w(LOGTAG,"NetReceiver Registered");
         WifiReceiver wi = WifiReceiver.getInstance(arg0,mWifiManager,mWifiManagerNew);
         final IntentFilter FilterW = new IntentFilter();
         arg0.registerReceiver(wi.ListenReceiver, FilterW);
        Log.w(LOGTAG,"ListenReceiver Registered");
         final IntentFilter FilterT = new IntentFilter();
         arg0.registerReceiver(wi.WifiReceiverB, FilterT);
        Log.w(LOGTAG,"WifiReceiver Registered");
//         final IntentFilter FilterO = new IntentFilter();
//             FilterT.addAction(Setting.ON);
//           arg0.registerReceiver(wi.OnReceiver, FilterO);
//          Log.w(LOGTAG,"WifiReceiver Registered");
        Intent on= new Intent(Setting.ON);


  static public WifiHandler getInstance()
   if ( single_instance == null )
       //single_instance = new WifiHandler();
       Log.i(LOGTAG, "WifiHandler instance created.(Constructor called)");
   return single_instance;
  public WifiHandler(Context ctx, WifiManager mw, WifiManagerNew mwn){


  public void run() {
    // TODO Auto-generated method stub
  //  final IntentFilter Filter = new IntentFilter();
  //       Filter.addAction(Setting.START);
   //      Log.i(LOGTAG, "COD");
        // ctx.registerReceiver(MyReceiver, Filter);


Java Source Code List