Skip to content

Commit

Permalink
adding project using ADB kivy and kivyMD
Browse files Browse the repository at this point in the history
  • Loading branch information
DeeppriyaGupta committed Oct 23, 2022
1 parent ed12703 commit d4b82da
Show file tree
Hide file tree
Showing 3 changed files with 53 additions and 0 deletions.
16 changes: 16 additions & 0 deletions ADB kivy, kivyMD/call.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
from ppadb.client import Client as AdbClient
import time
# Default is "127.0.0.1" and 5037
client = AdbClient(host="127.0.0.1", port=5037)
time.sleep(5)
phone=[12345,1236778]
for i in phone:
client.devices()[0].shell(f'am start -a android.intent.action.CALL -d tel:{i}')
time.sleep(.5)
x=int(client.devices()[0].shell('dumpsys telephony.registry').split('\n')[2][-1])!=0
while x:
x=int(client.devices()[0].shell('dumpsys telephony.registry').split('\n')[2][-1])!=0
print(x)
time.sleep(2)


18 changes: 18 additions & 0 deletions ADB kivy, kivyMD/call_phone.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
from ppadb.client import Client as AdbClient
from kivymd.app import MDApp
from kivy.uix.button import Button
from kivy.uix.screenmanager import Screen
client = AdbClient(host="127.0.0.1", port=5037)

class MainScreen(Screen):
def callback(self,phone):
print('calling')
print(client.devices()[0].shell(f'am start -a android.intent.action.CALL -d tel:{phone.text}'))
print('called')
class MainApp(MDApp):

def build(self):
return MainScreen()


MainApp().run()
19 changes: 19 additions & 0 deletions ADB kivy, kivyMD/main.kv
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
<MainScreen>:
BoxLayout:
orientation:'vertical'
size_hint:.65,1
pos_hint:{"center_x":.5,'center_y':.5}
BoxLayout:
MDTextField:
id : phone_no
hint_text: "enter phone number"
pos_hint:{'center_x':.5,'center_y':.5}
size_hint_y:None
width:self.parent.width*.8
BoxLayout:
MDRaisedButton:
text: "Call over WIFI"
md_bg_color: 1, 0, 1, 1
on_press: root.callback(phone_no)
pos_hint:{'center_x':.5,'center_y':.5}
width:self.parent.width

0 comments on commit d4b82da

Please sign in to comment.