1

I was using the connect-network API in my automation scripts on Nothing Phone (1). After updating my Android version to 13, it was not working and throwing the below error.

Spacewar:/ $ cmd -w wifi connect-network
Exception occurred while executing 'connect-network':
java.lang.SecurityException: Uid 2000 does not have access to connect-network wifi command (or such command doesn't exist)
        at com.android.server.wifi.WifiShellCommand.onCommand(WifiShellCommand.java:427)
        at com.android.wifi.x.com.android.modules.utils.BasicShellCommandHandler.exec(BasicShellCommandHandler.java:97)
        at com.android.server.wifi.WifiServiceImpl.handleShellCommand(WifiServiceImpl.java:4729) at android.os.Binder.onShellCommand(Binder.java:1102) 
        at android.os.Binder.shellCommand(Binder.java:1049) 
        at android.os.Binder.onTransact(Binder.java:877) 
        at android.net.wifi.IWifiManager$Stub.onTransact(IWifiManager.java:2138) 
        at android.os.Binder.execTransactInternal(Binder.java:1285) 
        at android.os.Binder.execTransact(Binder.java:1244) 

Has the command been changed or removed? Otherwise, what permissions do I need to enable to make it work?

3
  • 2
    You need root access. See android.googlesource.com/platform/packages/modules/Wifi/+/refs/…
    – Firelord
    Apr 30 at 7:24
  • Is there any other alternative way to connect to a particular network without root access? I need to run my automation scripts Apr 30 at 7:40
  • 1
    You could try an automation app from Play Store and see if on Android 13 that app is able to connect to a specific network or not. Give Automate or MacroDroid a try. I can't think of other alternatives which don't need root access.
    – Firelord
    Apr 30 at 8:58

0

You must log in to answer this question.

Browse other questions tagged .