My old smartphone is now a webcam

Some days ago, I moved from Italy to Germany after some personal troubles that convinced me that was time to make a change. I now have an apartment here and also a new job. The weekends and the holidays are always boring days, so in my free time I continue to write some easy Apps.

The apartment’s window looks toward a large square, so I decided to recycle an old smartphone to act as a webcam, placed behind such window. This is a screenshot of the application just started:

The circles with numbers are references for meanings of various boxes and buttons:

1) textbox for the username. This is used as an ID in file transfer
2) textbox for the server URL. This is used in picture transfer
3) textbox with the time. The time between two consecutive pictures (in seconds)
4) label with the time remaining before new picture will be taken (read note below)
5) label for messages to the user
6) button that closes the App

The box at left shows the preview image continuously taken by the camera.

When the App starts for the first time, you must fill all the textboxes with the relevant information. Such data will be stored on a file in the smartphone under a folder called “myWebcam”. The name of the file is settings.txt and is a pure text file. The next time that you open the application, your data will be loaded from file and set in the appropriate textboxes, so you will just start the program. The time for the first picture capture is set by default to 600 seconds; after that, it will be loaded from the programmed time (in box (3). Note: if you touch the label (4), its value will be forced to “1”, so this can be considered as a “quick start” button.

How it works

My first idea was to transfer the picture using a tiny ftp client, but there was a problem. The ftp server is in Italy and the login credentials coming from a Germany IP are rejected (password error) ; I know that the ftp server’s settings can be changed, in order to accept also other countries IPs, but I think it’s better not to do it… So the “B plan” was to use some Php scripts on the site and some specific HTTP POST requests, with the username (1) used as the auth_key and the server’s URL (2) as locator for the scripts. This way, the file transfer worked without any problems. The image has a VERY low resolution, so if you try to zoom it, you will have big pixels and no details. I did it this way to avoid privacy’s problems on the taken pictures.

Publishing on the Market

I will not publish this App on my Google Developer page, due to the need of a specific PHP script on a personal server and because to publish an App that uses the Camera, you must also supply a “Privacy Policy” document. I removed all my previous Apps that used the Camera from Google Play just to avoid to publish such document.

I think it would be enough to write in the App’s description: “This App uses your smartphone’s camera. It’s normal, ‘cause the purpose is to take pictures!”, but this is not enough. You have to publish somewhere a well formed document in full “legal terms”, so may be you have to pay a lawyer to publish your FREE App!

Here is a webcam picture, updated every 15 minutes if the device is ON:

test webcam
Note 2018/12/16: deactivated ‘cause I need the phone for new experiments, sorry!