CancelNotification
method cancels the registration for notification of new messages. It is available only in synchronous mode.
The following is an example for using CancelNotification
:
Synchronous
messaging_handle.call('CancelNotification',{'Type': u'NewMessage'})
The following table summarizes the specification of CancelNotification
:
Interface | IMessaging |
Description | Cancels registration for notification of new messages. |
Response Model | Synchronous |
Pre-condition | Valid instance of IMessaging interface is instantiated. |
Post-condition | Stop getting new message notifications. |
Input Parameters
Input parameter specifies the request for canceling notification of new messages. This must contain the Notification Type, and this property must contain the value NewMessage
.
|
Output Parameters
Output parameters contain ErrorCode
, and ErrorMessage
if the operation fails.
|
Errors
The following table lists the error codes and their values:
|
Error Messages
The following table lists the error messages and their description:
|
Example
The following sample code illustrates how to cancel a notification:
import scriptext import e32 lock = e32.Ao_lock() messaging_handle = scriptext.load('Service.Messaging', 'IMessaging') def new_sms_callback(trans_id, event_id, output_params): if trans_id == sms_id and event_id == scriptext.EventCompleted: print "SMS received from" + output_params['ReturnValue']['Sender']) else: print "Error in callback" # Cancel notification request messaging_handle.call('CancelNotification', {'Type': u'NewMessage'}) lock.signal() # The callback 'new_sms_callback' will be called when a sms is received sms_id = messaging_handle.call('RegisterNotification', {'Type': u'NewMessage'}, callback=new_sms_callback) # Send SMS to self so that the notification callback is hit messaging_handle.call('Send', {'MessageType': u'SMS', 'To': u'12345678', 'BodyText': u'Hi self'}) lock.wait()
See About this document... for information on suggesting changes.