As you can see, we declare MessageFrom1 and MessageBody1 as Process_globals.
Sub Process_Globals
'These global variables will be declared once when the application starts.
'
dim MessageFrom1 as string
dim MessageBody1 as string
dim SI as smsinterceptor
End Sub
When you declare under Process_Globals, you can get those variables from another activity/Service/Code module
To get the string in your main activity, we first need to insert the data(phone number and message body into the string. What we do as follow:
Sub SI_MessageReceived (From As String, Body As String)
MessageFrom1 = From 'here we give the Process_global variable the value From. (From As String)
MessageBody1 = Body 'here we give the Process_global variable the value Body. (Body As String)
toastmessageshow(MessageFrom1, true)
callsub("Main","MessageReceived") ' I will explain this later.
end sub
Now in your main activity, you can just normally declare two strings (doesn't have to be Process now because you will only need it in the activity itself) that we now call string strPhoneNumber and strPhoneBody. so:
dim strPhoneNumber, strPhoneBody as string
Now you could add something like the following code in the activity:
It's best that you type this code instead of copying as you will understand it.
Sub MessageReceived
strPhoneNumber = interceptor.MessageFrom1
strPhoneBody = interceptor.MessageBody1
End Sub
If you have typed this code, you can see that when you typed the dot (.) after interceptor it automatically gives you 2 possiblities. (interceptor.)
These possibilities are the process_globals, indeed
Ok, now I explain the callsub("Main","MessageReceived")
When you call callsub, Callsub calls a sub in an activity, so here in activity
Main, we call MessageReceived.
In 'MessageReceived', we update the strings strPhoneNumber and strPhoneBody with the values of the interceptors.
Now you have the values stored in your main activity.
Now you can add a button that shows the value.
sub btnShow_Click
msgbox(strPhoneBody, strPhoneNumber)
end sub
This will show a message box with the text of strPhoneBody as message and the caption is the phone number.
I hope the codes works a bit cause i made it a bit from scratch
Cheers, ;D
XverhelstX