Skip to content

SMS API

Send and receive SMS messages.

Methods

smsSend()

Send SMS message.

smsSend(destinationAddress, text)

Parameters: - destinationAddress (str): Phone number - text (str): Message text

smsGetMessageCount()

Get message count.

smsGetMessageCount(unreadOnly=False, folder="inbox")

smsGetMessageIds()

Get message IDs.

smsGetMessageIds(unreadOnly=False, folder="inbox")

smsGetMessages()

Get message details.

smsGetMessages(unreadOnly=False, folder="inbox", attributes=None)

smsGetMessageById()

Get a specific message by ID.

smsGetMessageById(id, attributes=None)

Parameters: - id (int): Message ID - attributes (list, optional): Specific attributes to retrieve

Returns: Message data dict

smsGetAttributes()

Get available SMS message attributes.

smsGetAttributes()

Returns: List of available attribute names

smsDeleteMessage()

Delete message.

smsDeleteMessage(id)

smsMarkMessageRead()

Mark message as read.

smsMarkMessageRead(ids, read=True)

Usage Example

import androidhelper

droid = androidhelper.Android()

# Send SMS
droid.smsSend("+1234567890", "Hello from QPython!")

# Get unread messages
messages = droid.smsGetMessages(unreadOnly=True).result
for msg in messages:
    print(f"From: {msg['address']}, Text: {msg['body']}")