Skip to content

Archive for April, 2011

Alarm Clock Plugin for Sony Ericsson LiveView uploaded to market

Apr 22 11
by mat

Following my previous two posts about Sony Ericssons LiveView (Quick Review and SDK & development) I have released my Alarm Clock Plugin for Sony Ericsson LiveView!

Find it on the android market:
https://market.android.com/details?id=com.stealthcopter.liveview.plugins.alarmclock

Would love some feedback from anyone with a LiveView, there must be someone else out there who has one right?

Sony Ericsson LiveView Alarm Clock Plugin

Sony Ericsson LiveView Alarm Clock Plugin

Sony Ericsson LiveView SDK and my Alarm Clock Plugin

Apr 14 11
by mat

So as I mentioned in a previous post I recently got a Sony Ericson LiveView watch, I decided to download the SDK and have a go at writing a plugin for use with the watch. The SDK is easy to use (developer world) and the examples and documentation (available here) is very clear and easy to understand. Unfortunately there is no emulator so you will have to go to the trouble of owning one of these devices if you want to test your app on it.

There are two types of plugins.
1. Announce plug-in

Announce plug-ins can send announcements to the LiveView™ device. This is done in
the same way as the predefined announce features, like Facebook and Twitter.

Gmail Plugin Emails

Gmail Plugin Emails

The SDK Announce plugin (helloWorldPlugin) example is very simple and and mostly contains code scheduling a timer to send events to the phone along. This is a single class which is supported by a small number of helper classes and the plugin only contains a few things foreign to a typical android application:

Just extend the class provided by the SDK for plugins:

public class HelloWorldService extends AbstractPluginService {

Send updates to the phone using the following function:

mLiveViewAdapter.sendAnnounce(mPluginId, mMenuIcon, header, body, System.currentTimeMillis(), "http://en.wikipedia.org/wiki/Hello_world_program");

Where:
mPluginId – identifies which app send the update
mMenuIcon – the icon the update will appear with
header – the title (IE: email subject)
body – the main text (IE: email text)
timestamp – timestamp of the announcement
link – action to perform when user clicks at end of message (event to occur on phone). This is interpreted by overriding the function below:

@Override
	protected void openInPhone(String openInPhoneAction) {
		Log.d(PluginConstants.LOG_TAG, "openInPhone: " + openInPhoneAction);
		
		// Open in browser.
		final Uri uri = Uri.parse(openInPhoneAction);
		final Intent browserIntent = new Intent();
		browserIntent.setData(uri);
		browserIntent.setClassName("com.android.browser", "com.android.browser.BrowserActivity");
		browserIntent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
		startActivity(browserIntent);
}

2. Sandbox

The sandbox plug-in can take complete control of the LiveView™ device by sending
images to it and control its ability to vibrate and display different colors on the LED. All
user activities are propagated to the plug-in, so that it can take appropriate actions.

Contact Call Plugin

Contact Call Plugin

We extend the same class however this time we say yes when we are asked if we are a sandbox plugin:

    @Override
	protected boolean isSandboxPlugin() {
        return true;
    }

So now rather than using sendAnnounce to send text to the liveview we directly send images. Below is a function used that draws some text to a bitmap and then sends it to be displayed.

    public static void sendTextBitmap(LiveViewAdapter liveView, int pluginId, String text, int bitmapSizeX, int fontSize) {
        // Empty bitmap and link the canvas to it
        Bitmap bitmap = null;
        try {
            bitmap = Bitmap.createBitmap(bitmapSizeX, fontSize, Bitmap.Config.RGB_565);
        }
        catch(IllegalArgumentException  e) {
            return;
        }
        
        Canvas canvas = new Canvas(bitmap);

        // Set the text properties in the canvas
        TextPaint textPaint = new TextPaint();
        textPaint.setTextSize(fontSize);
        textPaint.setColor(Color.WHITE);

        // Create the text layout and draw it to the canvas
        Layout textLayout = new StaticLayout(text, textPaint, bitmapSizeX, Layout.Alignment.ALIGN_CENTER, 1, 1, false);
        textLayout.draw(canvas);
        
        try
        { 
            liveView.sendImageAsBitmap(pluginId, centerX(bitmap), centerY(bitmap), bitmap);
        } catch(Exception e) {
            Log.d(PluginConstants.LOG_TAG, "Failed to send bitmap", e);
        }
    }

So we can create a similar function drawing whatever we want to a bitmap and then passing it onto the screen.

Only one thing left (I think). Intercepting button presses:

@Override
	protected void button(String buttonType, boolean doublepress, boolean longpress) {
          ....
         }

Where the the following buttons are defined:

  • PluginConstants.BUTTON_UP
  • PluginConstants.BUTTON_DOWN
  • PluginConstants.BUTTON_LEFT
  • PluginConstants.BUTTON_RIGHT
  • PluginConstants.BUTTON_SELECT

and we can see if the were tapped or held down with the boolean longpress. Note that we cannot detect longpresses of select as that will exit your plugin and the power button at all as that controls the screen.

My Attempt at a plugin: Alarm Clock
So I thought given that this thing is pretty much a watch, it would be useful to be able to set an alarm with it.

Plugin Icon

Plugin Icon


12hr clock (select sets alarm)

12hr clock (select sets alarm)


24hr clock

24hr clock

Unfortunately I don’t think it is possible to set the alarm programatically in android in versions prior to gingerbread (posted a stackoverflow question about it). So the user base is very limited, only users with gingerbread and higher with a LiveView will be able to use it so I don’t expect a massive response. Also I have no idea if this will work with non-stock alarm clock apps as I’m not aware of any manufacturers modification of gingerbread as of yet.

The LiveView application on the phone handles links to all the shared preferences for the plugins (they’re mandatory just for the enable/disable option) but an example is included in all the examples and it is very simple to just add more options to the preferences.xml and grab them in the code.

LiveView plugin settings

LiveView plugin settings

Alarm set via plugin

Alarm set via plugin

Conc
If you want more info please read the documentation linked at the start of this post. I will probably release the liveview alarm clock plugin onto the market soon, but I don’t expect the reception to be that good as it will only work on a few phones / tablets. Anyway I had fun programming for mine, enjoy!

Sony Ericsson LiveView Watch (Quick Review)

Apr 14 11
by mat

So about a week ago I decided to treat myself to a Sony Ericsson LiveView. It’s basically a watch with a 128×128 pixel screen that can display images/text sent from the phone. There are a few builtin apps that use this to send information to the phone (text messages etc.) and also an SDK is avaliable for developers to make further use of this device. Anyway here is a quick review of the device, I’ll post again soon with information about the SDK and developing a plugin.

Sony Ericsson LiveView Watch

Sony Ericsson LiveView Watch

Bluetooth connection
Well this is the major downfall of the device, it cannot hold a bluetooth connection very well with my phones (Nexus One and Desire HD) and constantly requires you to pull your phone out of your pocket to scan for bluetooth devices, pair with it, disconnect and reconnect in the LiveView program, restart your phone, or turn watch off and on in pairing mode.

LiveView lost connection

LiveView lost connection

This problem was significantly worse before installing the firmware update onto the LiveView (something which I strongly suggest as now it is only half as buggy). However the firmware update for this LiveView will only work on a Windows machine boo!!!

I’ve checked around a few forums and found that the bluetooth connection issues seem to be phone specific with the sony ericsson phones performing much better.

Builtin apps

  • Text messages – shows text messages you have received
  • Find phone – plays a sound on phone so you can find it… would be useful if I didn’t have to find my phone first to accept the pairing request!
  • RSS – not tested this, obvious what it does though
  • Missed calls – shows any missed calls you’ve had
  • Music control – volume control, next/prev, play/pause and sometimes displays current track name/artist

Plugins
There is a fairly complete list of plugins avaliable for liveview on the sony ericsson blog: blogs.sonyericsson.com. There aren’t too many apps available so it’s quite easy for devs to find something that hasn’t been done before with the liveview.

All the ones I’ve tried are quite good and function well but are perhaps not as ascetically pleasing as they could have been but I’m not going to complain about that.

Ones I’ve tried:

  • Gmail – Alerts you to new gmails and lets you read a snippet
  • Calendar plugin – Monthly view and agenda
  • Contact call – Browse contacts and intiate a call, I managed to accidentally call someone using this leading to much hilarity…
  • Binary clock – A binary clock, quite fun for geeks

Update issues
Most of the functions in the watch are for updates; tweets, text messages, emails etc… Unfortunatly many of these ‘plugins’ do not update properly, only showing updates that occurred whilst the watch was actively connected which means according to LiveView the last text I receive was 4 days ago… but I have had several since then… don’t think it would be very hard to fetch this information.

Lack of update for 4 days

Lack of update for 4 days

Just as a watch
So I decided I’d give this device a chance of working solely as a watch for a day.

The battery life quite good, still shows a full battery icon after 9 hours, which isn’t that shocking as the screen is only turned on when you want to know the time and it seldom requires to use bluetooth. I do wonder if it actually keeps track of the time onboard or if it keeps syncing (I suspect it doesn’t sync due to battery life and troubles syncing when using functions).

Conclusion
I’ve really tried hard to like this device but it really isn’t making it easy for me. I would recommend it if:

  • You’re a developer with a sony ericsson phone
  • Or the fun of writing an app will overwhelm the annoyance of constantly repairing

I wouldn’t recommend it if:

  • You’re an end user, looking for a cool watch
  • You’re need to rely on your watch to function
  • You want your watch to have all the standard functions
  • You don’t like re-pairing bluetooth devices repeatedly

Next
In my next post I’ll talk about the LiveView SDK and creating a LiveView plugin.

Received a box of 16 dead zebra android collectibles from funky peanut

Apr 11 11
by mat

As we end the first financial year for Stealthcopter Technologies the staff are treated (for tax purposes) to a box of 16 dead zebra collectibles.

Box of 16 dead zebra android collectibles

Box of 16 dead zebra android collectibles


16 dead zebra android collectibles unboxed

16 dead zebra android collectibles unboxed

The Cupcake one actually smells of cupcakes!!! amazing!

We actually ordered the last box (sorry!) of 16 from funkypeanut.co.uk for just over £100 including delivery, singles are still available though. There were actually some issues with paypal when checking out for this, but the admin of the store sent an email shortly afterwards to sort it out manually, great customer service!