Android Question Off/on data connection

Discussion in 'Android Questions' started by bgsoft, May 5, 2015.

  1. bgsoft

    bgsoft Well-Known Member Licensed User

    In Android 5x it's posible, turn off/on data connection?

  2. Erel

    Erel Administrator Staff Member Licensed User

    I don't think that it is possible.
  3. wes58

    wes58 Active Member Licensed User

    If you have a rooted phone you can use something like this:
    Sub ToggleDataConnection(dataState as Boolean)
    Dim ph As Phone
    Dim Command, Runner As String
    Dim StdOut, StdErr As StringBuilder
    Dim Result As Int
        Runner = 
    File.Combine(File.DirInternalCache, "runner")
        Command = 
    File.Combine(File.DirInternalCache, "command")
    File.WriteString(File.DirInternalCache, "runner""su < " & Command)

    if dataState then         ' turn data connection on
            File.WriteString(File.DirInternalCache, "command""svc data enable")
    else            ' turn data connection off
            File.WriteString(File.DirInternalCache, "command""svc data disable")
    end if
        Result = ph.Shell(
    "sh"Array As String(Runner), StdOut, StdErr)
    End Sub
  4. bgsoft

    bgsoft Well-Known Member Licensed User


    Thank you for your contribution.

    The problem is that most people who use this application are not root.

    If Google continues its policy so restrict things, in the end, we can not to program anything

    hookshy likes this.
  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice