38 lines
1.2 KiB
Python
38 lines
1.2 KiB
Python
import subprocess
|
|
|
|
from pojo.contact_pojo import ContactPojo
|
|
|
|
PACKAGE_NAME = "com.lpa.appointement"
|
|
ACTIVITY_NAME = "MainActivity"
|
|
BROADCAST_ACTION = "com.lpa.appointement.broadcast"
|
|
|
|
|
|
class Commandor:
|
|
|
|
def __init__(self):
|
|
pass
|
|
|
|
def start_page(self, contact: ContactPojo):
|
|
# specifying an explicit component name
|
|
self.clear_app_data()
|
|
|
|
subprocess.call(
|
|
"adb shell am start -n {}/.{} --es \"first_name\" \"{}\" --es \"last_name\" \"{}\" --es \"phone\" \"{}\" --es \"email\" \"{}\" --es \"passport\" \"{}\"".format(
|
|
PACKAGE_NAME, ACTIVITY_NAME, contact.first_name, contact.last_name, contact.phone, contact.mail, contact.passport), shell=True)
|
|
pass
|
|
|
|
def clear_app_data(self):
|
|
subprocess.call("adb shell pm clear {}".format(PACKAGE_NAME), shell=True)
|
|
|
|
def send_otp(self, otp: str):
|
|
subprocess.call(
|
|
"adb shell am broadcast -a {} --es otp \"{}\"".format(BROADCAST_ACTION, otp), shell=True)
|
|
pass
|
|
|
|
|
|
if __name__ == '__main__':
|
|
commandor = Commandor()
|
|
contact = ContactPojo("0649614591", "E24183897", "LIU", "Yusi", "AZEER", "lei-pan@outlook.com")
|
|
commandor.start_page(contact)
|
|
# commandor.send_otp("262353")
|