SoFunction
Updated on 2025-03-11

Android determines whether the connection is successful and the specified wifi is specified

Recently, when I was doing something related to wifi, I accidentally discovered a parameter. I changed the parameter to check whether the specified wifi was successfully connected, but this is hidden, so I reflected it. The code is as follows:

//Check whether wifi is connected through reflection and can start transferring data  private boolean checkWiFiConnectSuccess() {
    Class classType = ;
    try {
      Object invo = ();
      Object result = ().getMethod("getMeteredHint").invoke(invo);
      return (boolean) result;
    } catch (InstantiationException e) {
      ();
      return false;
    } catch (IllegalAccessException e) {
      ();
      return false;
    } catch (NoSuchMethodException e) {
      ();
      return false;
    } catch (InvocationTargetException e) {
      ();
      return false;
    }
  }

The above is all the content of this article. I hope that the content of this article will help you study or work. I also hope to support me more!