• After 15+ years, we've made a big change: Android Forums is now Early Bird Club. Learn more here.

Integrating a python scipt

Hello all,

I am trying to integrate a python script into an Android App. I have found there are many ways to go about this. I started with, and am still trying to go with google's Flutter app dev kit. I am using Android Studio v 3.3. I have found a python plugin that will allow me to launch an interactive command line console, and if I put the py script in that folder it will find it and run it. Working with that plugin (called Chaqopy) presents its own challenges and also is in straight Java. I have a good GUI going in flutter and I am thinking of just converting the python script to Java or C++ code to re-use it directly in Android Studio.
The python script uses libraries such as socket. Would I have to convert the library as well?

Does anyone have any idea off the top of their head which would be the best way for me to go? If I can launch it in the Java/Plugin project, maybe I should just start there, does that sound easiest?

Thanks
 
Re-write it in Java if you want to integrate this with an app.
 
What does this Python script do exactly? You're talking about two essentially incompatible technologies, and trying to shoehorn this into an Android app doesn't sound like the right approach. I mean why make yourself jump through hoops to get this working, when there's an equivalent Android/Java way of doing this, which will most likely be a much cleaner solution.
 
What does this Python script do exactly? You're talking about two essentially incompatible technologies, and trying to shoehorn this into an Android app doesn't sound like the right approach. I mean why make yourself jump through hoops to get this working, when there's an equivalent Android/Java way of doing this, which will most likely be a much cleaner solution.

It is a script that does basic read/write from PLCs and it is meant to be used on a PC. The entire point is to put it into a phone and then to do some things after that like array filtering and a nice UI with some other features I have in mind. This will be a sweet app to use in Controls Engineering, for the specific purpose I have in mind.

I would like a cleaner way to do it yes. How would you rewrite something if it uses libraries from its source language? Thanks for responding btw.
 
You do it using the equivalent libraries provided by the Android SDK. What's your interface to the PLC? I presume it's some kind of USB serial cable? It's possible to do serial comms in an Android app.
 
You do it using the equivalent libraries provided by the Android SDK. What's your interface to the PLC? I presume it's some kind of USB serial cable? It's possible to do serial comms in an Android app.

Its wifi. I will look into the equivalent libs thank you.
 
Back
Top Bottom