I am making an android app that provide a location for user for emergency situations . Now I want the app to enable the mobile data when the user open the app .. thanks in advance
1 Answer
Unless you have a rooted phone I don't think you can enable and disable data programmatically because in order to do so we have to include MODIFY_PHONE_STATE
permission which is only given to system or signature apps.
setMobileDataEnabled()
method is no longer callable via reflection. It was callable since Android 2.1 (API 7) to Android 4.4 (API 19) via reflection, but as of Android 5.0 and later, even with the rooted phones, the setMobileDataEnabled()
method is not callable.