I'm working on Flutter project in Android Studio platform and I faced a problem with how to write and run python API code inside my Flutter project without letting it as a backend code in another platform? since when I run my Flutter project that connected with python API code in another platform as a backend using post method, it's worked with the emulator but it does not work with my physical android device.
So is there any recommend solution for either the first problem or the second.
Thanks.
No it's not possible to write python code Inside Flutter code
But you can write your api in different framework like Django ,mongodb and use it in your Flutter app
Related
In my case I want to use Vosk in python for offline speech recognition and want to develope complete application on react native for handeling rest of the operation for controlling my phone. And this should be completely offline so don't want to setup saperate python server.
You can check their example of Android integration https://alphacephei.com/vosk/android and if you want to create a wrapper for React Native. Also, they have a wrapper for Native Script and you can check how they use it for android, for example here is a list of dependencies https://github.com/alphacep/nativescript-vosk/blob/master/src/platforms/android/include.gradle
UPDATE:
just found that react native vosk wrapper already exists: https://github.com/riderodd/react-native-vosk
I’m working on this face recognition app, so I am using android studio as front-end and python as a back-end.Upon designing my UI in android studio, I want to make a button in a way when i press it , my python script runs. If someone can help me I’d be very grateful.
Thanks in advance
What I think you need to do is run your python script on a server,
Then make a GET request from your app, on click or whatever, then out the response (generally in JSON) from your script.py
Is there any way for me to link a python back-end function to a flutter mobile application? I have a face recognition method on Python that needs to be linked to my front-end Flutter app.
It must also work offline
Let's say I have already done algorithms written in python, and now I want to use these algorithms in my android code. Can I use Java to get output from python? I need to send values from EditText as a parameter to python to be calculated in the algorithm and get a result. I can use Android Studio only with Java. Any suggestions?
Make a web API using python web framework like Django, Flask
Then send request to that API endpoint and calculate with your algorithm and return your result.
You can use Retrofit in Android studio to get the result.
Android studio doesn't have native support for python but you could try integrating a web API of python
I am currently working on a capstone project. One of the things that I am trying to achieve is to be able to get a number sent from a python code and get it displayed on my app that I am building through android studio.
My general knowledge on how to tackle this would be to set my python as a client which sends the number and android studio as a server which displays the number however I am having trouble on how to proceed with this and would appreciate it if someone could help me out.
I believe the simplest solution would be for you to create a very basic Flask server (not client!) on a Python host, and have it handle a basic GET call, which will be invoked from the Android client, using an implementation of your choice, see this tutorial for example