2015-07-04 2 views

ответ

0

Вы пытаетесь изменить настройки, которые были жёстко прописанные для андроида точки доступа Это из http://grepcode.com/file/repository.grepcode.com/java/ext/com.google.android/android/4.0.1_r1/android/net/wifi/WifiStateMachine.java

private boolean startTethering(ArrayList<String> available) {         

    boolean wifiAvailable = false;                

    checkAndSetConnectivityInstance();               

    String[] wifiRegexs = mCm.getTetherableWifiRegexs();          

    for (String intf : available) {               
     for (String regex : wifiRegexs) {              
      if (intf.matches(regex)) {               

       InterfaceConfiguration ifcg = null;           
       try {                   
        ifcg = mNwService.getInterfaceConfig(intf);        
        if (ifcg != null) {              
         /* IP/netmask: 192.168.43.1/255.255.255.0 */       
         ifcg.setLinkAddress(new LinkAddress(         
           NetworkUtils.numericToInetAddress("192.168.43.1"), 24));  
         ifcg.setInterfaceUp();             

         mNwService.setInterfaceConfig(intf, ifcg);        
        }                   
       } catch (Exception e) {              
        loge("Error configuring interface " + intf + ", :" + e);     
        return false;                
       }                    

       if(mCm.tether(intf) != ConnectivityManager.TETHER_ERROR_NO_ERROR) {   
        loge("Error tethering on " + intf);          
        return false;                
       }                    
       mTetherInterfaceName = intf;             
       return true;                 
      }                     
     }                      
    }                       
    // We found no interfaces to tether               
    return false;                    
} 

Попробуйте проверить этот ответ https://android.stackexchange.com/questions/46499/how-configure-the-dhcp-settings-of-wifi-tetheringhotspot-in-android

Смежные вопросы