android - unable to disable packet data after it has been enabled by my app -


i used method enable mobile data network application :

    private void setmobiledataenabled(context context, boolean enabled) throws exception   {     final connectivitymanager conman = (connectivitymanager)context.getsystemservice(context.connectivity_service);     final class conmanclass = class.forname(conman.getclass().getname());     final field iconnectivitymanagerfield = conmanclass.getdeclaredfield("mservice");     iconnectivitymanagerfield.setaccessible(true);     final object iconnectivitymanager = iconnectivitymanagerfield.get(conman);     final class iconnectivitymanagerclass = class.forname(iconnectivitymanager.getclass().getname());     final method setmobiledataenabledmethod = iconnectivitymanagerclass.getdeclaredmethod("setmobiledataenabled", boolean.type);     setmobiledataenabledmethod.setaccessible(true);     setmobiledataenabledmethod.invoke(iconnectivitymanager, enabled); } 

however, cannot disable manually unless totally close app holding home button , removing recent applications list. way solve problem? why packet data button of android system still attached application after closing it? why should totally close in order me disable data manually again?


Comments