public void configureWifi(String code,String data){
  boolean wifistatus=false;
  String ssid=null;
  String password=null;
  try {
    JSONObject wifiData=new JSONObject(data);
    if (!wifiData.isNull(resources.getString(R.string.intent_extra_ssid))) {
      ssid=(String)wifiData.get(resources.getString(R.string.intent_extra_ssid));
    }
    if (!wifiData.isNull(resources.getString(R.string.intent_extra_password))) {
      password=(String)wifiData.get(resources.getString(R.string.intent_extra_password));
    }
  }
 catch (  JSONException e) {
    Log.e(TAG,"Invalid JSON format " + e.toString());
  }
  WiFiConfig config=new WiFiConfig(context.getApplicationContext());
  wifistatus=config.saveWEPConfig(ssid,password);
  String status=null;
  if (wifistatus) {
    status=resources.getString(R.string.shared_pref_default_status);
  }
 else {
    status=resources.getString(R.string.shared_pref_false_status);
  }
  resultBuilder.build(code,status);
}

public void configureWifi ( String code , String data ) { boolean wifistatus = false ; String ssid = null ; String password = null ; try { JSONObject wifiData = new JSONObject ( data ) ; if ( ! wifiData . isNull ( resources . getString ( R . string . intent_extra_ssid ) ) ) { ssid = ( String ) wifiData . get ( resources . getString ( R . string . intent_extra_ssid ) ) ; } if ( ! wifiData . isNull ( resources . getString ( R . string . intent_extra_password ) ) ) { password = ( String ) wifiData . get ( resources . getString ( R . string . intent_extra_password ) ) ; } } catch ( JSONException e ) { Log . e ( TAG , "Invalid JSON format " + e . toString ( ) ) ; } WiFiConfig config = new WiFiConfig ( context . getApplicationContext ( ) ) ; wifistatus = config . saveWEPConfig ( ssid , password ) ; String status = null ; if ( wifistatus ) { status = resources . getString ( R . string . shared_pref_default_status ) ; } else { status = resources . getString ( R . string . shared_pref_false_status ) ; } resultBuilder . build ( code , status ) ; }
configure device wifi profile .
