• 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
 
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.
 
  • Like
Reactions: GameTheory
Upvote 0
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.
 
Upvote 0

BEST TECH IN 2023

We've been tracking upcoming products and ranking the best tech since 2007. Thanks for trusting our opinion: we get rewarded through affiliate links that earn us a commission and we invite you to learn more about us.

Smartphones