2022-09-16 12:07:57 -04:00
|
|
|
'''
|
|
|
|
Sms
|
|
|
|
====
|
|
|
|
|
|
|
|
The :class:`Sms` provides access to sending Sms from your device.
|
|
|
|
|
|
|
|
.. note::
|
|
|
|
|
|
|
|
On Android your app needs the SEND_SMS permission in order to
|
|
|
|
send sms messages.
|
|
|
|
|
|
|
|
.. versionadded:: 1.2.0
|
|
|
|
|
|
|
|
Simple Examples
|
|
|
|
---------------
|
|
|
|
|
|
|
|
To send sms::
|
|
|
|
|
|
|
|
>>> from plyer import sms
|
|
|
|
>>> recipient = 9999222299
|
|
|
|
>>> message = 'This is an example.'
|
|
|
|
>>> sms.send(recipient=recipient, message=message)
|
|
|
|
|
|
|
|
Supported Platforms
|
|
|
|
-------------------
|
2024-06-02 12:31:58 -04:00
|
|
|
Android, iOS, macOS
|
2022-09-16 12:07:57 -04:00
|
|
|
|
|
|
|
'''
|
|
|
|
|
|
|
|
|
|
|
|
class Sms:
|
|
|
|
'''
|
|
|
|
Sms facade.
|
|
|
|
'''
|
|
|
|
|
2024-06-02 12:31:58 -04:00
|
|
|
def send(self, recipient, message, mode=None, **kwargs):
|
2022-09-16 12:07:57 -04:00
|
|
|
'''
|
|
|
|
Send SMS or open SMS interface.
|
2024-06-02 12:31:58 -04:00
|
|
|
Includes optional `mode` parameter for macOS that can be set to
|
|
|
|
`'SMS'` if carrier-activated device is correctly paired and
|
|
|
|
configured to macOS.
|
2022-09-16 12:07:57 -04:00
|
|
|
|
|
|
|
:param recipient: The receiver
|
|
|
|
:param message: the message
|
2024-06-02 12:31:58 -04:00
|
|
|
:param mode: (optional, macOS only), can be set to 'iMessage'
|
|
|
|
(default) or 'SMS'
|
2022-09-16 12:07:57 -04:00
|
|
|
|
|
|
|
:type recipient: number
|
|
|
|
:type message: str
|
2024-06-02 12:31:58 -04:00
|
|
|
:type mode: str
|
2022-09-16 12:07:57 -04:00
|
|
|
'''
|
2024-06-02 12:31:58 -04:00
|
|
|
self._send(recipient=recipient, message=message, mode=mode, **kwargs)
|
2022-09-16 12:07:57 -04:00
|
|
|
|
|
|
|
# private
|
|
|
|
|
|
|
|
def _send(self, **kwargs):
|
|
|
|
raise NotImplementedError()
|