IncomingMessage

Description

Occurs when an incoming SMS message is received.

Event ID

Event ID

Objects

None

SMSSession

Arguments

Argument

Description

SMSAddress

Object of type SMSAddress that contains the address and address type from which the incoming message originated

SMSMessage

Object of type SMSMessage that includes the message ID and content of the incoming SMS message

Returns

Boolean. A return value of true is interpreted as a request to deletes the incoming message. A return value of false places the message in the SMS inbox. If no return value is specified, the default is false.

Usage

All instantiated SMSSession objects listening for messages are notified of an incoming SMS message. PocketBuilder can prevent the message from displaying in the SMS inbox if you set the IncomingMessage event to return true. If any SMSSession object requests deletion of the message by returning true for the IncomingMessage event, PocketBuilder will attempt to delete the message, but only after all SMSSession objects have processed the message.

NoteDeletion of messages is dependent on registry setting PocketBuilder applications can receive notification of an SMS message only after you register the shim DLL, PKSMS25.DLL, on your device. The ReadOnly registry attribute for the DLL must be set to 0 before PocketBuilder can delete an SMS message For information on registering the DLL and the ReadOnly registry attribute, see the chapter on Working with Native Objects and Controls in the Users Guide.

The IncomingMessage event is synchronous with the operating system processing SMS messages. Therefore you should not include code that prompts for user input, or perform any lengthy operation in the script for this event.

Examples

Example 1

The following code in the IncomingMessage event determines whether an incoming SMS message is placed in the SMS inbox or is deleted based on whether or not the message contains the text “top secret”:

// If the message contains "top secret" it will deleted.

// Otherwise, it is placed in the inbox.


if POS(SMSMsg.text, "top secret") <> 0 then

	// delete this e-mail and notify user of deletion

   //  in a MultiLineEdit control

	mle_status.text += "~r~nWill be deleted.~r~n"

	return TRUE

end if


// allow to go into the inbox

return FALSE