Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Turn your Python application into an Android APK - Build your own python and extension

License

MIT, LGPL-2.1 licenses found

Licenses found

MIT
LICENSE
LGPL-2.1
COPYING
Notifications You must be signed in to change notification settings

dl1ksv/python-for-android

Open more actions menu
 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Python for Android

Python for android is a project to create your own Python distribution including the modules you want, and create an apk including python, libs, and your application.

The gnuradio branch contains recipes to build gnuradio applications for android. You can even build Android packages from python code generated by grc.

Global overview

  1. Download Android NDK, SDK

  2. Launch "android", and download latest Android platform

  3. Export some environment variables:

    export ANDROIDSDK=<path/to/android-sdk>"
    export ANDROIDNDK="/path/to/android-ndk>"
    export ANDROIDNDKVER=r10            # This version I tested against
    export ANDROIDAPI=21                # I tested against
    
    (Of course correct the paths mentioned in ANDROIDSDK and ANDROIDNDK)
    
  4. Clone python-for-android:

    git clone git://github.com/dl1ksv/python-for-android
    git checkout gnuradio
    
  5. Build a gnuradio distribution

    cd python-for-android
    ./distribute.sh -m "audiostream gnuradio tinyalsa osmosdr kivy" -C -d gnuradio
    
    After some cups of tea you should find a build.py in the directory
    dist/gnuradio
    
  6. Go to gnuradio-examples/scripts directory::

    There you'll find some scripts to build some examples.

    • build_dialtone.sh

    This app is taken from the gnuradio dialtone example and should directly run on your android device. It does not use alsa but instead audiostream for accessing the speaker.

    Install te app by

    adb install ../../dist/gnuradio/bin/Dialtone-1.0-debug.apk

    Starting this app you'll get a button to start/stop the dialtone example.

    • build_dialtonealsa.sh

    Here tinyalsa is used to access the speaker via alsa. This example may directly work on android 4 ( I could not test ). On android 5 the app requires special permissions. The used card number is 1 and teh device is 0. These parameters are hard coded in

    self.tinyalsa_talsa_sink_0 = tinyalsa.talsa_sink(samp_rate, 1, 0)

    Maybe you have to change these paramters depending on your hardware.

    I tested on a rooted nexus 7 and granted permissions by the means of SuperSu by:

    ( See:
    

    http://su.chainfire.eu/#selinux-policies-allows

    )

    adb push audiopolicy.sh /sdcard/

    adb shell

    su

    sh /sdcard/audiopolicy.sh

    Install the app by

    adb install ../../dist/gnuradio/bin/Dialtonealsa-1.0-debug.apk

    Then you can run the app.

    The permissions are lost after reboot!

    • build_dialtone_nokivy.sh

    Before running this example you have to grant the permissions like described above.

    This app was generated by renameing the python file generated by grc to main.py and applying the build process.

    • build_rtlsdr.sh

    At the moment this is he most complex example. It's an FM receiver receiving a fixed frequency. ( The frequency ist fixed at the moment as there is no gui to set the frequency. At the moment this example requires libusb on your android device.

    How to install libusb see:

    https://github.com/libusb/libusb/tree/master/android

    Additionaly you have to grant audio and usb permissions.

    You'll find the scripts in the srcipts directory.

    Important!!!!!

    You'll have to run the usbpolicy.sh script after attaching rtl dongle to your android device!!

  7. Credits

Some ideas for the recipes are taken from

http://gnuradio.org/redmine/projects/gnuradio/wiki/Android

About

Turn your Python application into an Android APK - Build your own python and extension

Resources

License

MIT, LGPL-2.1 licenses found

Licenses found

MIT
LICENSE
LGPL-2.1
COPYING

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • C 82.6%
  • Shell 4.4%
  • Python 4.2%
  • C++ 3.7%
  • Assembly 1.0%
  • Java 1.0%
  • Other 3.1%
Morty Proxy This is a proxified and sanitized view of the page, visit original site.