I made an app with python and Kivy and it works perfectly on my pc but when I built the app with buildozer and open it on my android phone it doesn’t send any data but it said it is connected and shows the right ip.
I set permission INTERNET to true.
this is my code
ps. sorry for my bad English
--> this is the main app
from kivy.uix.floatlayout import FloatLayout
from kivy.uix.textinput import TextInput
from kivy.uix.scatter import Scatter
from kivy.uix.button import Button
from kivy.uix.widget import Widget
from kivy.uix.label import Label
from kivy.config import Config
from kivy.app import App
import threading
import socket
import time
import os
# set screen height and with
Config.set('graphics', 'height', '600')
Config.set('graphics', 'width', '350')
mousePos = ""
class MainApp(FloatLayout):
# mousePos movement
def on_touch_move(self, touch):
global mousePos #
x = str(touch) # i really don't know how
list = x.split (' ') # butt it works
mousePos = list[3:] #
# sent mousePos to screen
self.ids.Texthi.text = str(mousePos)
# my advanced multithreading server to client connection made by me
def connected(self):
def tryToConnect():
print("tryToConnect")
getCustomIP = self.ids.getCustomIP.text
getCustomPORT = self.ids.getCustomPORT.text
self.ids.connectToServer.text = "connecting to \"" + getCustomIP + "\" on port " + getCustomPORT
s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
try:
s.connect((getCustomIP, int(getCustomPORT)))
self.ids.connectToServer.text = "connected to \"" + getCustomIP + "\" on port " + getCustomPORT
print("connected")
except Exception as e:
print(e)
self.ids.connectToServer.text = "connection faild pls try again!"
return
print("start sending data in Lööps")
x = 1
while x == 1:
time.sleep(0.5) # so i don't destroy the network
try:
mousePosStrByte = bytes(str(mousePos), 'utf-8') #something to string to bytes
s.send(mousePosStrByte) # send to client
except Exception as e:
#self.ids.connectToServer.text = e
print(e)
self.ids.connectToServer.text = "your victim has disconnected"
x = 0
print("2" , x)
s.close()
print("start thread 1 tryToConnect")
our_thread = threading.Thread( target=tryToConnect, name="thread 1")
our_thread.start()
class TestApp(App):
def build(self):
return MainApp()
if __name__ == '__main__':
TestApp().run()