How can I sign my application with the system signature key?

后端 未结 2 1425
自闭症患者
自闭症患者 2020-11-30 09:18

I need to create a Robotium application that would use Settings application to turn ON/OFF WIFi from menu Settings->Wireless & networks->Wi-Fi. I managed to find some sa

2条回答
  •  余生分开走
    2020-11-30 09:52

    The best way to enable wifi from your application would be to use the WifiManager.

    WifiManager wManager = (WifiManager)getSystemService(Context.WIFI_SERVICE);
    
    if(!wManager.isWifiEnabled() && wManager.getWifiState() != WifiManager.WIFI_STATE_ENABLING)
        wManager.setWifiEnabled(true);
    

    Note: You also have to add the following permissions to your manifest

    
    
    

提交回复
热议问题