Smart Mail – extending regular mail

March 22nd, 2010 — 12:08pm

I’ve just finished extending the concept of regular mail to virtual mail. The idea is to be notified every time the mailman leaves a package for me in the mailbox. Another functionality is being notified that someone took the mail from inside the mailbox.

I’ll attach a demo and source code ASAP.

Comment » | Projects

Android Overcharged v3: battery monitor.

March 19th, 2010 — 1:27pm

Just updated my first public Android application: Overcharged.

Overcharged icon

It is a battery monitor application, which alerts you when your battery is full, avoiding you to overcharge it and also wasting power, saving you money overtime.

Change log:
V3
- Customizable notifications
- Control over the service
- Fixed notifications alert

V2
- Notify only once when full, otherwise it would drain your battery by nagging you.
- Runs as a service that starts at boot time
- Fast and lightweight, only 12K in memory!
- Display more relevant information about the battery, such as temperature, voltage and health.

Comment » | Projects

Dan Willis talk – “Everything you know about web design is wrong!”

February 10th, 2010 — 7:30am

Dan Willis gave this talk at 2009 SXSWi and it’s 4:44 seconds long. The content though goes beyond that lenght. Willis’ argues that there needs to be a shift from today’s perspective that web design is something that looks pretty, to something that needs to be experienced in a totally different manner. Giving an example about Amazon that does daily trials of different web design interactions, he claims that even if what you thought today might seem crazy, in the future it might be just like that.

Indeed, exploring and trying is what makes HCI so interesting!

Comment » | Design

Keeping your Android Service running

February 7th, 2010 — 6:24pm

I’ve been scratching my head on how can I keep a background service running indefinitely. After googling a bit about this, I found this particular blog post with a reply from a Google employee that helped a lot:

You can not count on onDestory being called for anything. You can count on onStop being called. For a service you should consider it dead after it returns from onStop. For an Activity you should consider it dead after onPause is called.

That is, you can use onStop to restart your service, preventing it from being trashed by Android cleanup crew :)

Comment » | Android

Android live screen capture: ScreenCast

January 8th, 2010 — 3:06am

I wanted to capture how my applications look. Using DDMS allows you to capture still images of the interface, but what if you want to show someone your application running live without using an out-of-focus camera like we see on Youtube?

Here is a nice application I found while Googling: Android Screencast

Android Screencast screenshot

Android ScreenCast

Comment » | Android

Android: How to get the battery level

January 3rd, 2010 — 4:50pm

I wanted to make my application behave differently according to the battery available on the device. Looking into the developer webpage led me nowhere. Looking into the default list of intents that Android supports, I found that there is an action that is called when the battery is changed (Intent.ACTION_BATTERY_CHANGED). Using the getExtras() functions, I figured out that in this intent, the current level and scale of the battery readings is provided.

Other values you might be interested in: present, technology, plugged, scale, icon-small, health, voltage, level, temperature, status

So I created a Service, which uses a BroadcastReceiver to monitor the changes on the battery levels.

Here is how it looks:

public class Battery_service extends Service {

	private static BroadcastReceiver batteryInfo = new BroadcastReceiver() {

		@Override
		public void onReceive(Context context, Intent intent) {
			// TODO Auto-generated method stub
			String action = intent.getAction();

			if(Intent.ACTION_BATTERY_CHANGED.equals(action)) {
				int reading = intent.getIntExtra("level", 0);
				int percentage = intent.getIntExtra("scale", 100);

				Aware.setBattery("Battery: "+reading*100/percentage + "%");
			}
		}
	};

	@Override
	public IBinder onBind(Intent intent) {
		// TODO Auto-generated method stub
		return null;
	}

	@Override
	public void onStart(Intent intent, int startId) {
		// TODO Auto-generated method stub
		super.onStart(intent, startId);

		registerReceiver(batteryInfo, new IntentFilter(Intent.ACTION_BATTERY_CHANGED));
	}

	@Override
	public void onDestroy() {
		// TODO Auto-generated method stub
		super.onDestroy();

		unregisterReceiver(batteryInfo);
	}
}

Aware is an Activity, where there is a function that updates the battery level reading on the GUI.

Hope it helps!

Comment » | Android

Android windows with scrolling

December 16th, 2009 — 9:10pm

I was having a problem when I had more content than the space on the screen of the Android. I figured out how to create a scrolling window, so that the application can grow vertically or horizontally as we want.

By default, when we create an Activity, it comes with a LinearLayout. If you have more content than whats available or change to landscape, you’ll get stuff left outside the screen. To solve that, cut the LinearLayout, add a ScrollView and paste again your LinearLayout. That way, if your content is bigger than what’s available on the screen, a scrolling bar will appear, allowing you to access your information.

ScrollView with LinearLayout inside!

Hope it helps!

Comment » | Android

Ambient Notifier with Android and Arduino

December 12th, 2009 — 2:12pm

For Making Things Interactive class with Prof. Mark D. Gross, I’ve made an ambient display device. I got the idea for the project when I was at home, with my cell phone charging. Someone called me and I didn’t hear the phone ringing. I spent the all day working at home, totally unaware that someone had called. Wouldn’t it be great if I had some other means of knowing when should I look for my phone?

I had to overcome the hardest part in my project, which was making an Arduino talk to my cell phone. In order to do that, I had to get an WiShield from Async Labs. Using their examples, I managed to create a Socket server that accepts phone events from the phone and actuates any sensor in the Arduino. On the phone, an event monitor was created, which listens for incoming calls. When an event that I’m interested occurs (in my case, ringing, missed call and new SMS), the phone application sends a message to the WiShield, which interprets what’s required and triggers the action on the Arduino board.

A question that got me thinking during my preparation for the final demo for the class was: “How do I get the Ambient Notifier to reset if I don’t want to call the person back?”
Since there aren’t any switches, I resolved to capture the shaking movement on the phone, since it’s so popular for the undo and reset status on the iPhone.

Here you can find the source code for Arduino+WiShield side: Arduino Ambient Notifier

Here you can find the source code for Android side: Android Ambient Notifier
Here you can find my report: Ambient Notifier report
Here you can find a poster for my demo: Ambient Notifier poster
Here you also can find a paper I wrote about this project:Ambient Notifier Paper for Making Things Interactive

Here is a demo video of Ambient Notifier working:

Comment » | Projects

Fix multiple instances of Activity and reboot on orientation change

December 8th, 2009 — 4:56pm

Does it happen to you that your application restarts itself when you change the device orientation? Also, when you open your application after a while, it creates a new runtime of the application, although you are sure there was another instance running because you returned to Home and it was there?

This simple change in the AndroidManifest.xml fixes both problems:

AndroidManifest.xml

Select your Activity node, and on the right:
Launch mode: change it to “singleInstance”
Config changes: “keyboardHidden|orientation”

So basically what we are doing is saying to Android that you want your application to be persistent and that you only want one instance of it running. The config changes part is to let Android know that the configuration you had before is valid even if you popup the keyboard on G1 or change the device orientation.

Hope it helps!

Comment » | Android

Java Serial Communication in Mac OS X Snow Leopard

December 1st, 2009 — 10:59pm

Hi there fellow developer,

If you are having problems getting to compile code using rxtx library, don’t feel alone, I’ve been there too… Apparently, the library doesn’t work as of now with 64bits Java, which is what’s included with Snow Leopard.

To overcome that issue, you need to download the librxtxSerial.jnilib compiled for 64bits support and the latest rxtx library for Mac OS X.

- Place the librxtxSerial.jnilib in /Library/Java/Extensions/ folder in your Mac.
- In your Java project, add a reference to the RXTXcomm.jar file that you’ll find inside the rxtx library zip file (you’ll need to extract the file rxtx-2.1-7-bins-r2.zip.

To test it out, you can follow this code: http://java.sun.com/developer/releases/javacomm/SimpleRead.java

Good luck and happy coding!

Comment » | Tips

Back to top