Ambient light sensor bug on Hero

Some Android models come with a Ambient light sensor that adjusts the back light depending on the ambient light (duh :p) while a nice feature it does however it doesn't play well with the setBrightness function. Currently the only way to override this behaviour seems to be to check Disable auto back light under Sound & Display in settings. Confirmed to work HTC Hero, once my Nexus One arrives I'll see if it has the same behaviour. Googling tells me that it might also work for Droid. Update 2010-03-08: Revived my Nexus One, it comes with automatic brightness disabled, however setBrightness still works as intended with automatic brightness enabled.

Using MultipartEntity in Android applications

To be able to upload files from an Android application and use the Multipart content type you need to add some additional jar files to your application. The files needed are apache-mime4j, httpclient, httpcore and httpmime. All are opensource projects built by the Apache foundation. Download the 4 files and add them to your project then you should be able to use the following code to post strings and files to pages.
HttpClient httpclient = new DefaultHttpClient();
HttpPost httppost = new HttpPost("http://www.tumblr.com/api/write");

try {
	MultipartEntity entity = new MultipartEntity();

	entity.addPart("type", new StringBody("photo"));
	entity.addPart("data", new FileBody(image));
	httppost.setEntity(entity);
	HttpResponse response = httpclient.execute(httppost);
} catch (ClientProtocolException e) {
} catch (IOException e) {
}
The image variable in this case is a File that contains an image captured by the camera on the phone.

Flashlight 1.2

A couple of days ago I uploaded version 1.2 of flashlight on market. It feels the the final version things added from 1.1 is support for red tint (use of a red background instead of white). The project is hosted on github and can be found here: http://github.com/FredrikL/android-flashlight. Some market statistics as of today:
  • 3850 downloads
  • 61% active installs
  • Rated 4/5 (32 ratings)
I was thinking of having this post as some kind of code review but since there's not that much code in the application itself it didn't seem like much of a point.

Flashlight

So, just uploaded my first Android application to Android Market. It's called Flashlight, at this stage very very simple. The only thing it does is to set the brightness to 100% and shows a fullscreen white background. So yes I agree that it's quite boring but i have some ideas of features to add, and I'm open for suggestions. Since opensource is fun I'll add upload it to github as soon as i get the hang of git. Not sure how long it takes for AndroLib to index the app but it can be found on the Market just search for 'Flashlight' and look for my name. Another way of finding it would be to search on the package name: com.tacticalnuclearstrike.flashlight.