Import python code in android project - android

I have a monitoring application that can be used to monitor devices using android. I currently have the code in python that I run from windows via ADB and get the results on windows in a CSV file.
I would like to create an android project that would behave as described above (an APK, in Java on eclipse), so I can run it without using ADB.
Is there a possibility that I can include the existing python code and call the methods from the old code (after installing the apk on an android device)?
Despite my online research - I could not get appropriate results. Can someone help me out here?
Thank you.

Did you check SL4A and Py4A ?
http://code.google.com/p/python-for-android/
You may check QPython too.

Related

Running a kivy program on Android

First of all i am aware that there have been alot of similair questions asked already, but somehow i cant figure anything out, I have a python-kivy program that I want to run on Android, the program works perfectly on my computer, I've ran various simple programs using Python Interpreter with Kivy, so far it was the best open source I could find, but there is some nasty problems with it.
I've been to https://kivy.org/docs/guide/packaging-android.html#packaging-android and since i already had Kivy Launcher installed on my phone i tried that one first, however when i open the app i get a message:
No projects are available to luanch. Please place a project into storage/emulated/0/kivy and restart this application. Press back button to exit.
at https://kivy.org/docs/guide/packaging-android.html#packaging-android I readed that the 'project' consists of my main code, lets say main.py, and android.txt, the android.txt must contain a few things that i wont mention now, these two files must be placed in a folder and placed at the asked directory.
I did this, but i still got the same message.
I've thought of trying Buildozer, but i did not seem to find a proper instalation for it on android.
I'm asking advice, becouse i think that the answer to my problems might not be so dificuilt, so any advice apreciated.
Thanks and regards.
Cid-El
ps. Android Lollipop, python 3.4
You may try using buildozer to package your app and deploy to Android device directly for debug, you only need to install this in your machine, and change the developer options in Android to allow external source.
Basically once you install the buildozer, you need to initialise a project by:
buildozer init
Make sure you have the required dependencies and targeted Android SDK/NDK in your system.
Then it's only a simple edit the build manifest for Python specific dependencies (external modules etc).
And run locally by:
buildozer android deploy run
Read more about buildozer here
Hope this helps.

Python, Kivy: Building an Android Package (.apk)

As the title says, I'm trying to build an Android Package (.apk / App) using Python and Kivy. I've got no idea how to convert .py to .apk or if it's even possible like this. So my questions are:
What programs do I need, to turn my .py files into .apk s?
How do I install these programs? (Sometimes a little bit difficult with python modules etc.)
How do I use these programs to do it?
Will it work on Windows? (As I'm using Windows, that's my main question :/ )
Thank you for hopefully coming answers :)
Use the Kivy documentation here and here.
You cannot currently use these tools on windows, but you can use a linux virtual machine. This is explained in the above documentation.

Running OpenCV Python code on Rooted Android

I tried using QPython, but had difficulties in installing numpy, let alone OpenCV . Is there anyway I can run my OpenCV code on android? I have read this answer, Is there a way to run Python on Android? , however, I need to know if OpenCV is supported in particular. If not, is it possible to run it on a rooted android phone?

Use OpenCV in existing Java Android application

I need to have some code to do some image processing in an existing Android app written in java. Currently my code is written in Python with OpenCV, and running on a PC.
Now I need it too run in the said app too.
I tried running it via sl4a with py4a, which for simple python scripts is OK, but I need to use OpenCV, and couldn't figure how to format it for py4a. (Any idea how to do this?)
What are my options for running Python code using OpenCV inside of an existing Java Android app?

Running a Python app on real Android phone

In order to develop an Android app using Python, I need to install Python for Android and SL4A on my computer to be used with the Android emulator. My question is, when I distribute this app to actual users/phones, do the phones need to get Python for Android and SL4A explicitly? Or is the supporting infrastructure built into Android devices? Or is there a way to package the Python application where the users do not have to get SL4A and Python for Android in order to run the application?
Instructions on redistributing your script to run on devices other than your development one are here:
http://code.google.com/p/android-scripting/wiki/SharingScripts
You can wrap them in a template project and build a stand alone apk.
Your users have to install SL4A and the language plugin (python?) on their phones, this is not a built-in functionality.
Since the source code is available, it's possible to create combined application, which includes your scripts and SL4A/python code, but in my opinion this defies the purpose of scripting in the first place.

Categories

Resources