1

I am trying to enable/disable mobile data.

First, is it possible to implement this?

I am gone through the below link

How to disable Mobile Data on Android

Enable/disable data connection in android programmatically

But I am not getting the right way to implement this.

Getting InvocationTargetException and not able to add MODIFY_PHONE_STATE also in android manifest file as it is a system-only permission.

And from forum I came to know that it was deprecated after Gingerbread.

How do I need to implement this?

4
  • did you added these permissions uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" uses-permission android:name="android.permission.CHANGE_NETWORK_STATE" uses-permission android:name="android.permission.INTERNET" uses-permission android:name="android.permission.READ_PHONE_STATE" Commented Aug 20, 2014 at 6:21
  • 1
    MODIFY_PHONE_STATE cannot be used by third party apps. Check this documentation.developer.android.com/reference/android/… Commented Aug 20, 2014 at 6:26
  • Users would not like this behavior and its not possible without user interaction. Commented Aug 20, 2014 at 6:30
  • Thanks to Arash & shruti :) Commented Aug 20, 2014 at 6:53

1 Answer 1

2

I am trying to enable/disable mobile data.

First, is it possible to implement this?

No, that's not possible to achieve by third-party apps. Enabling/disabling mobile data should be done through system Settings app UI.

What you can do is to provide an instruction to end user on how to enable/disable mobile data and direct them to Settings app.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.