R RichyK68 Active Member Licensed User Longtime User Nov 28, 2015 #1 Hi, For several years I've been using the following code to enable/disable data on a device: B4X: Try Dim r As Reflector r.Target = r.GetContext r.Target = r.RunMethod2("getSystemService", "connectivity", "java.lang.String") r.RunMethod2("setMobileDataEnabled", enabled, "java.lang.boolean") Catch Log("SetMobileDataEnabled: " & LastException.Message) End Try On my new Nexus 6P phone running Marshmallow, my app has stopped working so I've debugged it and found it throws the error SetMobileDataEnabled: java.lang.Exception: java.lang.NoSuchMethodException: setMobileDataEnabled [boolean] Does anybody know the Marshmallow equivalent to turn data on and off? Thanks, Richard ps why the hell do Google make such a breaking change?
Hi, For several years I've been using the following code to enable/disable data on a device: B4X: Try Dim r As Reflector r.Target = r.GetContext r.Target = r.RunMethod2("getSystemService", "connectivity", "java.lang.String") r.RunMethod2("setMobileDataEnabled", enabled, "java.lang.boolean") Catch Log("SetMobileDataEnabled: " & LastException.Message) End Try On my new Nexus 6P phone running Marshmallow, my app has stopped working so I've debugged it and found it throws the error SetMobileDataEnabled: java.lang.Exception: java.lang.NoSuchMethodException: setMobileDataEnabled [boolean] Does anybody know the Marshmallow equivalent to turn data on and off? Thanks, Richard ps why the hell do Google make such a breaking change?
Erel B4X founder Staff member Licensed User Longtime User Nov 29, 2015 #2 I don't think that there is any replacement available: https://code.google.com/p/android-developer-preview/issues/detail?id=2103 Upvote 0
I don't think that there is any replacement available: https://code.google.com/p/android-developer-preview/issues/detail?id=2103