Sub ToggleDataConnection(dataState as Boolean)
Dim ph As Phone
Dim Command, Runner As String
Dim StdOut, StdErr As StringBuilder
Dim Result As Int
StdOut.Initialize
StdErr.Initialize
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