You should pass two StringBuilders to P.Shell. It will allow you to read stdout and stderr.
I manually set the timezone to Eastern (-5)
Then I run the app which should change the timezone. (If I issue the same command using ADB over a usb connection it changes fine.)
#Region Project Attributes
#ApplicationLabel: Set Timezone
#VersionCode: 1
#VersionName: 1.0
'SupportedOrientations possible values: unspecified, landscape or portrait.
#SupportedOrientations: unspecified
#CanInstallToExternalStorage: False
#End Region
#Region Activity Attributes
#FullScreen: False
#IncludeTitle: True
#End Region
Sub Process_Globals
'These global variables will be declared once when the application starts.
'These variables can be accessed from all modules.
End Sub
Sub Globals
'These global variables will be redeclared each time the activity is created.
'These variables can only be accessed from this module.
End Sub
Sub Activity_Create(FirstTime As Boolean)
'Do not forget to load the layout file created with the visual designer. For example:
'Activity.LoadLayout("Layout1")
Msgbox(GetPropInfo, "Set Timezone")
Activity.Finish
End Sub
Sub Activity_Resume
End Sub
Sub Activity_Pause(UserClosed As Boolean)
End Sub
Sub GetPropInfo As String
' Libs: Core (v/2.47), Phone (v/2.01)
Dim P As Phone
Dim sb,rwout,rwerr As StringBuilder
Dim i As Int
Dim PropData() As String
Dim mycmd,arg1,arg2, stz As String
ProgressDialogShow("Please wait...")
sb.Initialize
rwout.Initialize
rwerr.Initialize
arg1="persist.sys.timezone"
arg2="America/Chicago"
mycmd="setprop"
P.Shell("getprop", Null, sb, Null)
PropData = Regex.Split(CRLF,sb.ToString)
For i = 0 To PropData.Length - 1
If PropData(i).Contains("[persist.sys.timezone]") Then
Log(i & " " & PropData(i))
Exit
End If
Next
P.Shell(mycmd,Array As String(arg1,arg2),rwout,rwerr)
Log("RWOUT: " & rwout)
Log("RWERR: "& rwerr)
P.Shell("getprop", Null, sb, Null)
PropData = Regex.Split(CRLF,sb.ToString)
For i = 0 To PropData.Length - 1
If PropData(i).Contains("[persist.sys.timezone]") Then
Log(i & " " & PropData(i))
stz = PropData(i)
stz = stz.Replace("[","")
stz = stz.Replace("]","")
stz = stz.SubString(stz.IndexOf(" ")).Trim
Exit
End If
Next
ProgressDialogHide
Return "Time Zone : " & stz & CRLF
'
End Sub