Saturday, July 19, 2014

PirateBox for Android - Modding

Here are the workshop slides I prepared for the PirateBox Camp #2 in Lille. Because they were not used at the camp I'll post them here, so they are not lost.
The slides show the range of possible modifications to the PirateBox for Android, ranging form simple preference changes to the more advanced use of the Android API.

Here are the slides, more details and download links are available below the presentation.
 
The first slide shows the Basic Settings that can be changed inside the preferences of the PirateBox app.
These basic settings allow to change things like the SSID name, storage directory etc. without deeper knowledge of the PirateBox.

The next slide Content Modifications shows the settings needed to make basic changes to the HTML, CSS and JavaScript files. After ticking the Content to SD option, the app has to be restarted for the change to take effect. After the restart you should find a folder named piratebox on your SD card (or wherever your external storage file system is located).

Inside the piratebox folder you'll find a directory named html which contains all the HTML, CSS and JavaScript files. If you are making changes to files located inside the html directory, make sure that the option Enable Updates is not ticked to prevent the next update of the app to overwrite your changes.
You will also notice that the html directory contains files with the extension xhtml. These files are html files that, in addition to standard HTML, include dynamic content. Dynamic content is covered in the slides that follow.

The next five slide (Dynamic Pages, Using BeanShell, XHTML Example, XHTML Errors and BeanShell DIY) cover the use of dynamic pages by using BeanShell. The slide named BeanShell DIY contains a download link (available below) that offers you the possibility to execute BeanShell code directly on your device.

The last two slides (Using the Android API and Android API DIY) are targeted at developers that already know the Android API. The Adroid API DIY links to a ZIP file (download below) that contains an example that shows the use of the Android API to access the music stored on the Android device. After unzipping the files to the html directory you should have an additional menu entry named Media inside the menu of your PirateBox start page.

If you are interested in how that works you can inspect the xhtml files included inside the ZIP file. But event if you are not into development the sample might be a nice addition to your PirateBox.

Downloads

The files referred to inside the presentation are available on Google Drive:
camp#2/beanshell.zip
camp#2/android_media.zip

Tuesday, July 15, 2014

PirateShare

PirateShare is an app that tries to simplify file upload to a PirateBox by using Android's share functionality.
On the PirateBox Camp #2 we tried the app and it seems to work quite well.
Android Share Dialog (image by #BiblioBox)

PirateShare was inspired by the PirateFox a PirateBox file sharing app for FireFox OS:

http://ruk.ca/content/piratebox-firefox-os-piratefox
https://github.com/reinvented/piratefox

The  PirateShare app is available for download on Google Drive:
http://t.co/j7oiLJdZuT


The app works like this:

  1. Select one or multiple photos from the Gallery or select file(s) inside a file management app
  2. Select PirateShare from share menu
  3. PirateShare checks if connected to a PirateBox by requesting the ncsi.txt file
  4. If connected PirateShare will upload the file(s)
Upload Dialog