forked from TheAlgorithms/Python
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
adding project using ADB kivy and kivyMD
- Loading branch information
1 parent
ed12703
commit d4b82da
Showing
3 changed files
with
53 additions
and
0 deletions.
There are no files selected for viewing
This file contains 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
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) | ||
|
||
|
This file contains 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
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() |
This file contains 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
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 |