Last active
September 26, 2018 14:08
-
-
Save morrah/c4e770934243515b26b2185abe07d4bf to your computer and use it in GitHub Desktop.
qpython script for sms forwarding
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# TODO: subscribe SMS_RECEIVED_ACTION instead of polling | |
import androidhelper | |
import sys | |
from time import sleep | |
FORWARD_TO = '+79218887766' | |
LIMIT = 3 | |
counter = 0 | |
droid = androidhelper.Android() | |
while True: | |
sleep(5) | |
sms_list = droid.smsGetMessages(True).result | |
for sms in sms_list: | |
print (sms) | |
droid.smsMarkMessageRead([int(sms['_id'])], True) | |
droid.smsSend(FORWARD_TO, '%s: %s' % (sms['address'], sms['body'])) | |
counter += 1 | |
if counter >= LIMIT: | |
sys.exit() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment