Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Android Integration with Python

Android Integration with Python

Transcript:

- Let's start by how I came across this topic.
- So in my 2nd year I was new to Programming or development since I didn't take any cs subject till my 12th to focus on my "IIT prep", well let's not go there. So we had to decide a topic for our 2nd year mini project and as I was new to coding my role in the team was exploring ideas
Later on, however, when I realized how simple everything was if you had the will to learn new things, my role in the team changed from brainstormer to the core developer.
- So the Idea that intrigued me the most was to make an app that would allow you to point the camera at your pet and it will take pictures of it smiling.
- So I went on with it and while exploring on how to actually make it I figured that Python would be a great choice because of its support for image processing. Then I made some small projects with OpenCV and a limitation that bugged me was those projects were run in console and the app that we intended to build can't be limited to the console.
- So to make it easily accessible we decided to make an android application. So now it was like we’ll have to create an android app with python support to take advantage of the Great libraries.
- So I explored and found out that we can either create the entire application in python using python frameworks like Kivy/QPython or create an android application using java and create a backend with flask or django but in either of the options there were limitations which made them unsuitable for our app.
- Main limitation of python frameworks is that Android doesn’t support native Python development, these tools convert the Python apps into Android Packages that can run on Android devices. So using python frameworks meant we lose access to the rich UI libraries and the native experience of Android.
- So the other option was using Java/kotlin for frontend and flask/django web app as backend. We tried to integrate them but faced many performance issues as the live feed of the camera had to be sent to the web app through the internet, process it and send the output back to the frontend to display it. This made the app very slow and dependent on the speed of internet connection which meant that the app would require an active internet connection every time you use it.
- Then finally I found it. The main highlight of this talk The ChaquoPy Library. *ChaquoPy* provides everything you need to include Python components in an Android app, including
- The python frameworks limitation of not providing the rich native experience was overcome by the use of ChaquoPy as our options now included both python and java so we can use the best of both
- And we are not losing out on the native support because of its seamless integration with Android Studio’s standard Gradle build system.

Japneet Rajput

December 06, 2022
Tweet

Other Decks in Technology

Transcript

  1. Why Python for App Development Support for ML/DL Great for

    Visualizing Data and Reports Massive Community Flexible integrations 1 2 4 3
  2. Python for Android ML models deployed on web • Kivy

    • QPython • PySide Flask/Django Python Frameworks for Android Dev
  3. Cons of Python Frameworks Native User Experience No support for

    Android OS Limited and rigid UI Libraries
  4. What is ChaquoPy? • Seamless integration with Android Studio’s standard

    Gradle build system. • Simple APIs for calling Python code from Java/Kotlin, and vice versa. • Support for third-party Python packages, including SciPy, OpenCV, and many more.