Sub Process_Globals
End Sub
Sub Globals
End Sub
Sub Activity_Create(FirstTime As Boolean)
End Sub
Sub SetAirplaneMode(On As Boolean)
Dim p As Phone
If on = GetAirplaneMode Then Return 'already in the correct state
Dim r As Reflector
Dim contentResolver As Object
r.Target = r.GetContext
contentResolver = r.RunMethod("getContentResolver")
Dim state As Int
If on Then state = 1 Else state = 0
r.RunStaticMethod("android.provider.Settings$System", "putInt", _
Array As Object(contentResolver, "airplane_mode_on", state), _
Array As String("android.content.ContentResolver", "java.lang.String", "java.lang.int"))
Dim i As Intent
i.Initialize("android.intent.action.AIRPLANE_MODE", "")
i.PutExtra("state", "" & On)
p.SendBroadcastIntent(i)
End Sub
Sub GetAirplaneMode As Boolean
Dim p As Phone
Return p.GetSettings("airplane_mode_on") = 1
End Sub
Sub Activity_Click
SetAirplaneMode(Not(GetAirplaneMode))
Log(GetAirplaneMode)
End Sub
Sub Activity_Resume
End Sub