Wednesday, May 21, 2014

PirateBox at Google Play

After quite some testing PirateBox for Android is now available at Google Play.
Thanks a lot to all of you for testing. Special thanks goes to Skyworth S8 for testing and sending in lots of screen shots (see gallery below).

The APKs will also be published to Google Drive, so installation will be possible for devices without Goggle Apps.

In case of errors or if you would like to provide feedback, please send a mail to piratebox[at]fun2code.de or leave a comment below.




Links

PirateBox at Google Play
APKs on Google Drive

Saturday, May 17, 2014

PirateBox Reloaded - Episode III

Version 0.4.4 of PirateBox for Android is now available. This post is about the new and noteworthy features of that version.

If tests go well and I have enough feedback I will make PirateBox for Android available at Google Play. So please fill out the questionnaire ... feedback has been very sparse lately.

Droopy Support

The original PirateBox uses Droopy for file upload. PirateBox for Android uses his own mechanism for file uploads. To be compatible Droopy emulation has been introduced. If the Emulate Droopy option is enabled (which it is by default) files can be uploaded by using port 8080.

PirateBox and PirateFox

This makes it possible to use existing file upload tools. For testing the FireFox OS app PirateFox has been used (see image).

In addition to the file upload feature, a number is added to the uploaded file name if the file already exists. In earlier versions files with the same name were silently overwritten.


Info Widget

Info Widget
To make it easier to see if files were uploaded or new messages are available the new version contains a new widget which displays this information.

The counters should update automatically. If that does not work, you can force an update by tapping the widget.

Tasker/Locale Plugin

To make automation easier the latest version contains a Tasker/Locale plugin.
With this plugin it is possible to define tasks to switch the PirateBox on/off automatically.

Tasker
It has to be noted, that there are problems when using WiFi on/off as trigger. This is likely to not work as expected. I hope I'll be able to fix that in upcoming versions.





Status Broadcasts

This might only be interesting for developers but it is now possible to request the status of the PirateBox externally via broadcast. The new Info Widget uses this functionality and might serve as example.

The broadcast action used for the status request is de.fun2code.android.piratebox.broadcast.intent.STATUS_REQUEST and the PirateBox app will respond with a de.fun2code.android.piratebox.broadcast.intent.STATUS_RESULT broadcast which contains the following extras:

SERVER_STATE
  boolean value: true if the server is running, otherwise false

UPLOAD_NUMBER
  int value: number of uploaded files

SHOUT_NUMBER
  int value: number of shout/chat messages

UPLOAD_DIR
  String value: upload directory location

SHOUT_DIR
  String value: shout/chat directory location


That's it for the new version ... looking forward to receiving more feedback :)

Friday, May 9, 2014

PirateBox Reloaded - Episode II

First of all thanks to all of you who gave feedback regarding the PirateBox for Android. The feedback was very useful and showed that there are problems when running the app on Android 4.x.
Meanwhile I've rooted my Galaxy Nexus (still on stock ROM) running 4.3, so I had the change for in depth testing. The result is version 0.4.0 of the app which includes a different handling of the dnsmasq process. I'll go a little into detail to describe the changes that have been made.

Those of  you not interested can jump directly to the end of this post where the download link is located. I've also added the questionnaire again. It would be really nice if you could provide feedback, it's  really useful.

Wrapping Dnsmasq

In previous version of the app the dnsmasq process was killed and restarted with the --address=/#/. This worked fine on Android 2.x devices but lead to a continuous restart of the AP (Access Point) on Android 4.x devices.
The new approach is different in the way that it does not kill the dnsmasq process but installs a wrapper script that is created before the AP stars and removed afterwards.
For this to work the app saves a copy of the file /system/bin/dnsmasq to /system/bin/dansmasq.pb.real. On start of the PirateBox service the wrapper script is created which overwrites the /system/bin/dnsmasq command. After the AP is started the original dnsmasq binary is restored.
The wrapper script looks like this:

#!/system/bin/sh
exec /system/bin/dnsmasq.pb.real --address=/#/192.168.43.1 $*

The wrapper calls the original dnsmasq binary which is now located at /system/bin/dnsmasq.pb.real with the --address and all other other parameters ($*) the system used to start dnsmasq.

If you look at the process list after starting the AP you should see that the backed up dnsmasq.pb.real is running instead of the real one (dnsmasq).
Here is the result of the ps | grep dnsmasq command:

shell@maguro:/ $ ps | grep dnsmasq
nobody    5088  121   928    496   ffffffff 00000000 S /system/bin/dnsmasq.pb.backup

New Preferences

The preference screen has two new additions. One is the IP address of the AP and the other is the option to restore the original dnsmasq binary.

New Preference Options
In previous versions the IP of the AP could determined after the AP was started and used to restart dnsmasq. This is no longer possible, because the wrapper script has to be created before the AP starts.

On Android most of the devices have the IP address 192.168.43.1 hard coded and I don't believe that there are a lot ROMs with different addresses. Should your AP start with a different IP address, you can still change this by using the new preference setting AP IP Number.

The second new preferences option is called Restore "dnsmasq" Binary. This will, as the name implies, try to restore the original dnsmasq binary. This should not be necessary to used, because the wrapper is removed and replaced by the original binary after the AP has been started. But in case thing do not work as desired when the device is used for standard tethering, this is the option to restore the binary.

Simple Widget

The new version also comes with a simple widget. It is not pretty ... but hey, I'm a developer not an artist ;)
Meanwhile I've updated the widget images in version 0.4.1, hope the widget is looking a bit better.

Below are the links to the app, the questionnaire and to the source code located at GitHub.
So I hope the new version is working better as the previous version and I'm looking forward for your feedback.



Source Code

The source code is now available on GitHub.

Download Links

Google Drive: PirateBox APKs

Questionnaire

The results can be viewed here, so you know on which configurations PirateBox is running.