#Region Service Attributes
#StartAtBoot: False
#StartCommandReturnValue: android.app.Service.START_STICKY
#End Region
Sub Process_Globals
'These global variables will be declared once when the application starts.
'These variables can be accessed from all modules.
Dim UDPSocket1 As UDPSocket
End Sub
Sub Service_Create
ToastMessageShow("Create myUDPService", False)
Log ("Create myUDPService")
End Sub
Sub Service_Start (StartingIntent As Intent)
If UDPSocket1.IsInitialized = False Then
UDPSocket1.Initialize("UDP", 8888, 8000)
End If
End Sub
Sub Service_Destroy
ToastMessageShow("Going Down", False)
Log ("WE ARE GOING DOWN!!!!!!!!!!!!!!")
End Sub
Sub UDP_PacketArrived (Packet As UDPPacket)
Dim msg As String
msg = BytesToString(Packet.Data, Packet.Offset, Packet.Length, "UTF8")
msg = msg.Trim
If msg = "code1" Then
CallSubDelayed2 (Main, "SetButton", True)
StartActivity(Main)
Else
CallSubDelayed2 (Main, "SetButton", False)
End If
ToastMessageShow(msg, True)
End Sub