android - java.lang.NoSuchMethodException: getTetherableIfaces on Lollipop -
my application needs check whether there available usb tetherable interface. uses reflection call gettetherableifaces on connectivitymanager.
connectivitymanager cm = (connectivitymanager) context.getsystemservice(context.connectivity_service); class cmclass = class.forname(cm.getclass().getname()); method method = cmclass.getdeclaredmethod("gettetherableifaces"); method.setaccessible(true); method.invoke(cm, args); i've tested on lg leon running android 5.0.1 , fails java.lang.nosuchmethodexception.
has functionality been dropped or changed in lollipop?
according http://grepcode.com/file/repository.grepcode.com/java/ext/com.google.android/android/5.0.1_r1/android/net/connectivitymanager.java#connectivitymanager.gettetherableifaces%28%29 method still exists.
maybe should try connectivitymanager.class.getdeclaredmethod("gettetherableifaces") instead.
have tried see list of metods connectivity manager ? can show logs of following code.
method[] methodarray = connectivitymanager.class.getmethods(); (method method : methodarray) { log.v(tag, method.getname()); }
Comments
Post a Comment