From 2009, ancient history, I can't remember what news story led me to make this. The repository is long gone but I found a news article with some details and a Github Gist with the core logic. The BlackBerry API was incredibly simple and naive (as was my coding ability). This was made before Gandhi's racism and sexual assaults were well known.
//gCam.java
//This file is part of the Hippocamp Source Library.
//
//Hippocamp Source Library is free software: you can redistribute it and/or modify
//it under the terms of the GNU General Public License as published by
//the Free Software Foundation, either version 3 of the License, or
//(at your option) any later version.
//
//Hippocamp Source Library is distributed in the hope that it will be useful,
//but WITHOUT ANY WARRANTY; without even the implied warranty of
//MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
//GNU General Public License for more details.
//
//You should have received a copy of the GNU General Public License
//along with the Hippocamp Source Library. If not, see .
package com.hippocamp.ghandicam;
import java.io.ByteArrayOutputStream;
import java.io.IOException;
import java.io.InputStream;
import javax.microedition.io.Connector;
import javax.microedition.io.file.FileConnection;
import net.rim.blackberry.api.mail.Address;
import net.rim.blackberry.api.mail.Message;
import net.rim.blackberry.api.mail.MessagingException;
import net.rim.blackberry.api.mail.Multipart;
import net.rim.blackberry.api.mail.SupportedAttachmentPart;
import net.rim.blackberry.api.mail.Transport;
import net.rim.device.api.io.file.FileSystemJournal;
import net.rim.device.api.io.file.FileSystemJournalEntry;
import net.rim.device.api.io.file.FileSystemJournalListener;
import net.rim.device.api.system.SystemListener2;
import net.rim.device.api.system.USBPort;
import net.rim.device.api.ui.UiApplication;
//Stripped down version of the GandhiCam application, Screen and Settings class removed.
//Not meant as a usable app, to build and test in the BlackBerry emu look at
//'Auto-run on Startup' and 'System Module' in the JDE Project properties
public class gCam extends UiApplication implements FileSystemJournalListener {
FileConnection fileConnection = null;
gCam app = this;
boolean doCapture = false;
String path;
String title;
String mime;
//dummy params to mimic persistable settings class:
boolean active = true;
boolean captureVideo = true;
boolean captureAudio = true;
boolean capturePhoto = true;
String emailAddress = "myname@mycomany.net";
public static void main(String[] args) {
new gCam().enterEventDispatcher();
}
public gCam() {
addFileSystemJournalListener(this);
}
public void fileJournalChanged() {
//Don't do anything if USB is connected (user can drag files to the SD from desktop)
if (USBPort.getConnectionState() != SystemListener2.USB_STATE_CABLE_CONNECTED) {
//has app been initialised and does user want to save files?
if (active && !emailAddress.equals("")) {
long nextUSN = FileSystemJournal.getNextUSN();
FileSystemJournalEntry entry = FileSystemJournal.getEntry(nextUSN - 1);
//File is created when record starts, but only written to when saved
if (entry.getEvent() == FileSystemJournalEntry.FILE_CHANGED) {
try {
path = "file://" + entry.getPath();
if (path.endsWith(".3GP") || path.endsWith(".3gp")) {
title = "GandhiCam Video";
mime = "video/3gpp";
if (captureVideo) {
doCapture = true;
} else {
doCapture = false;
}
}
if (path.endsWith(".amr") || path.endsWith(".AMR")) {
title = "GandhiCam Audio";
mime = "audio/amr";
if (captureAudio) {
doCapture = true;
} else {
doCapture = false;
}
}
if (path.endsWith(".jpg") || path.endsWith(".JPG")) {
title = "GandhiCam Photo";
mime = "image/jpeg";
if (capturePhoto) {
doCapture = true;
} else {
doCapture = false;
}
}
if (doCapture) {
doCapture = false;//Reset so subsequent files don't get sent
//Only create the file connection if we're doing a gandhi-send
fileConnection = (FileConnection) Connector.open(path);
if (fileConnection.exists()) {
if (fileConnection.canRead() && fileConnection.availableSize() > 10) {
//Create the email
Message message = new Message();
Address ghandicamAddress = new Address(emailAddress, title);
Address[] ghandicamAddressArray = new Address[1];
ghandicamAddressArray[0] = ghandicamAddress;
message.addRecipients(Message.RecipientType.TO, ghandicamAddressArray);
message.setSubject(title);
//Get the file data
InputStream input = fileConnection.openInputStream();
ByteArrayOutputStream dataOuput = new ByteArrayOutputStream();
int i = 0;
while ((i = input.read()) != -1) {
dataOuput.write(i);
}
byte[] fileData = dataOuput.toByteArray();
fileConnection.close();
//Create the attachment
Multipart mPart = new Multipart();
String fileName = path.substring(path.lastIndexOf("/".charAt(0)) + 1, path.length());
SupportedAttachmentPart filePart = new SupportedAttachmentPart(mPart, mime, fileName, fileData);
mPart.addBodyPart(filePart);
message.setContent(mPart);
Transport.send(message);
}
}
}
} catch (IOException ex) {
ex.printStackTrace();
} catch (MessagingException ex) {
ex.printStackTrace();
} finally {
if (fileConnection != null) {
try {
fileConnection.close();
} catch (IOException ex) {
ex.printStackTrace();
}
}
}
}
}
}
}
}
From www.technovelgy.com:
GandhiCam for post-8700-series Blackberry devices is an application that will automatically wirelessly upload your pictures or video as they are taken to prevent confiscation by the police. This application is a response to a spate of incidents in which UK police have deleted or confiscated pictures taken by tourists or by protesters at events like the G20 summit.
"This app is for BlackBerry only and is compiled using the 4.2.1 SDK, it’s only been tested on a 9000/Bold but should work on all post-8700 series devices (Pearl/8100, 8800, Curve/8300, Bold/9000). This is completely unsupported by Hippocamp Software, if it doesn’t work for you we’re sorry but can’t spare the time to help. If you’re using a Storm - good luck."
The name "GandhiCam" derives from the satyagraha philosophy of civil resistance developed by Mohandas Gandhi and applied so successfully during the Indian struggle for independence from Britain. One of the key elements in the application of satyagraha to solving social problems is making sure that the protest is public and preferably photographed to be seen by as many people as possible.
The creator of GandhiCam credits a Reddit user - Shaper_pmp - with the concept (and the excellent name). However, I'd be inclined to credit David Brin for the concept. In his excellent 1990 novel Earth, Brin writes about a surveillance technology that the oldtimers (aka baby boomers) used in most public places. True-Vu goggles were worn rather than conventional sunglasses; everything the True-Vu goggles saw was recorded for later use in court, if necessary:
"Watching, all the time watching... goggle-eye geeks... What brought on Crat's sudden outburst was the sight of yet another babushka, glaring at them from a bench under one of the force-grown shade trees... The very moment they came into view, the old woman laid here wire-knitting aside and fixed them with the bug-eyed, opaque gape of her True-Vu lenses...