#Region Project Attributes
#ApplicationLabel: SMSTest
#VersionCode: 1
#VersionName:
'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.
Dim SMS As PhoneSms
Dim PE As PhoneEvents
Dim PhoneID As PhoneId
Private Button1 As Button
Private Label1 As Label
Private EditText1 As EditText
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")
EditText1.Color=Colors.White
End Sub
Sub Activity_Resume
End Sub
Sub Activity_Pause (UserClosed As Boolean)
End Sub
Sub Button1_Click
Test
End Sub
Sub Test
Log("Sending Message")
PE.InitializeWithPhoneState("PE", PhoneID)
Dim PhoneNumber As String ="07700900000" 'UK format - un-issued number!
Dim Message As String = "Hi there at " & DateTime.Time(DateTime.Now)
'SMS.Send(PhoneNumber,Message)
Dim WantSentStatus As Boolean = True
Dim WantDeliveryNotification As Boolean = True
Try
EditText1.Text=$"Sending Message to ${PhoneNumber}
Message: ${Message}
"$
SMS.Send2(PhoneNumber,Message,WantSentStatus,WantDeliveryNotification)
Catch
Log("Error when sending: " & LastException.Message)
EditText1.Text=EditText1.Text & LastException.Message & CRLF
End Try
End Sub
Sub PE_SmsDelivered (PhoneNumber As String, Intent As Intent)
'Have never got a receipt from SMS using this!
Dim Result As String
Result="Receipt received from " & PhoneNumber
Log(Result)
EditText1.Text=EditText1.Text & Result & CRLF
End Sub
Sub PE_SmsSentStatus(Success As Boolean, ErrorMessage As String, PhoneNumber As String, Intent As Intent)
Dim Result As String
Result="SMS Sent Status:" & Success & " : " & ErrorMessage & " " & PhoneNumber
Log(Result)
EditText1.Text=EditText1.Text & Result & CRLF
End Sub