Skip to main content

Screen Flashlight: Building the first app


So, I finally got an Android-based Acer Liquid S100 (Liquid E, with 512Mb RAM). I've spent some time to get accustomed to the Acer changes to the UI and apps and finally found that I can not use Funambol Sync properly on that device. Acer simply replaced the Contacts application with their own version which does not ask for the application to edit the contact. Basically Funambol Contacts are read-only on that device. So I started looking around to find how android is being built.

Liquid E does not have any flash LED (the only thing I am missing that was in my Nokia 5530). The flashlight is rather important to have so every time I reflashed the device to stock state I had to go to Android Market and pick the simplest app possible. At some moment I realized that I cannot find that application anymore.

How hard is it to build a blank screen/full brightness app?


screenlight/AndroidManifest.xml (Source)

<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android=""
    <application android:icon="@drawable/icon"
        <activity android:name=".ScreenLight"
                <action android:name="android.intent.action.MAIN" />
                <category android:name="android.intent.category.LAUNCHER" />

The source code goes to src/com/errormessaging/screenlight/

screenlight/ (Source)

package com.errormessaging.screenlight;

import android.os.Bundle;
import android.view.WindowManager;

public class ScreenLight extends Activity {
    /** Called when the activity is first created. */
    public void onCreate(Bundle savedInstanceState) {
        WindowManager.LayoutParams lp = getWindow().getAttributes();
        lp.screenBrightness = 1f;
        lp.flags |= WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON;


That's it.


Full source code for this awesome application is available in Launchpad Bazaar:

bzr branch lp:~rye/+junk/screenlight-android

You can download the compiled Screen Light.apk (signed with debug key) from Ubuntu One.