Skip to main content

Posts

Showing posts from May, 2010

Using chmod in Android

Java doesn't have native support for platform dependent operations like chmod. However, Android provides utilities for some of these operations via android.os.FileUtils . The FileUtils class is not part of the public SDK and is therefore not supported. So, use this at your own risk: public int chmod(File path, int mode) throws Exception { Class fileUtils = Class.forName("android.os.FileUtils"); Method setPermissions = fileUtils.getMethod("setPermissions", String.class, int.class, int.class, int.class); return (Integer) setPermissions.invoke(null, path.getAbsolutePath(), mode, -1, -1); } ... chmod("/foo/bar/baz", 0755); ...
Read more

Bot Commander r1 Released

I just published Bot Commander , the code for my Lego NXT rover . There's a lot left to be done, but release early and often, right? Currently it provides a UI for controlling the direction and speed of all three motor ports on the NXT brick. You can link motors together to adjust their speed in unison. In addition, you can enable "Tilt Control" for a steering-wheel-type experience. To use tilt control: Hook up motor A and B to be the left and right wheels of your vehicle. Hold the phone sideways (i.e. landscape). Tilt the phone forward and backward to drive forward and backward. Turn the phone right and left (like a steering wheel) to steer right and left. As you tilt the phone, you'll see the UI update the slider controls for the speed of motors A and B. I plan to expand the UI to provide a lot more than just motor control. Before that, though, I'll push a JAR to make it easy to integrate control of Lego NXT robots into your own Android project. The code
Read more

Review of Halo ODST

Halo ODST is pretty good, but not stellar. It was very easy to beat. Damon says : I had fun playing the game (like I always do with the Halo franchise), but the story line was really weak. There's a few points where you get to hear some audio from a girl trying to navigate New Mombasa while it's under attack by the Covenant. The audio is hard to hear and really just not compelling. You progress through the game partly through flash backs (of a sort, you play as your comrades) and partly through, what I'm going to call, "normal time." Some of the battles where good, but they were all pretty standard to Halo (even to the point of ending the game with a Warthog race). I was hoping for something different from a game where you're not playing the Master Chief. The visor mode is interesting, but only useful because they make the game impossible to play without it. Everything is quite dark and the visor allows you to see, in addition to your hand in front of y
Read more

ASE r23 Released

So, what's new? Features: Added support for adjusting and inspecting media volume. Also added inspecting the maximum volume for media and ringer.  Added APIs for accessing the contacts database.  pickPhone() API now returns the chosen phone number instead of the data URI.  Added APIs for generating DTMF tones (see DTMF dialer example ).  Bug fixes: Wake lock bugs fixed. Perl error messages make more sense.  SMS bugs fixed.  Broken error responses fixed.  Under the covers: Usage tracking happens in a background thread pool which should make the application more responsive.  Usage tracking now includes API use. Arguments are not logged, only that a particular API is used. This will help significantly with prioritizing bugs and feature development. So please, enable usage tracking!  In the works: Still working on distributing interpreters as APKs separately from ASE. This is an arduous task.  More advanced triggers.  A new slider input dialog. A new spinner input di
Read more

Review of Mass Effect 2

Mass Effect 2 is a real adventure. Laura says : I loved, loved, loved this game. I felt like I was reading a relatively entertaining sci-fi novel with a good plot despite somewhat strained writing at times. I actually got into it watching Damon choose renegade options and thinking, "Why? The other one would have been so much better!" The whole choose-your-own-adventure aspect (RPG? Is that what they're calling it these days?) is neat. I love the idea of being a hero or a badass. ( Damon says : I prefer to live in the moment. If the guy is a jerk, punch him in the face. If it's a little kid, cut him a break.) ( Laura says :   Yeah, but you did not, in fact, cut the kid a break!) In fact, I really liked how your decisions from the first game affect the second so much that after beating the second with the default settings I went back and played the first again so that I could load a character who had made different (paragon) choices. And now I am playing the first
Read more

DTMF Dialer in ASE

I just wrote a useful little script using some new APIs that will be in version r23. import android import time droid = android.Android() phone = droid.pickPhone().result.replace('-', '') phone = phone.replace('+49', '0') droid.makeToast('Dialing ' + phone + ' in 2 seconds.') time.sleep(2) droid.setMediaVolume(droid.getMaxMediaVolume().result) droid.generateDtmfTones(phone) droid.exit() I have a shortcut to this script on my home screen. When I want to place a call on a land line, I can start it up, choose the number I want to dial, and hold it up to the phone. This script is pretty naive about the format of the phone number. It expects German numbers (the +49) that it's dialing within Germany (the leading 0). Here's the QR code to add this script to ASE:
Read more

Android Lego NXT Rover with Stereoscopic Vision

This is a Lego NXT rover I built. It has independent suspension and enough torque to climb over the annoying threshold trim in every doorway of my apartment. It carries two Android G1s that will eventually provide stereoscopic vision and remote control via Wifi. Currently, it's remotely controlled by my Nexus One via Bluetooth. I experimented a bit with adding four wheel steering, but it got rather complex. Skid steering works well enough for now. If the software side of things works out well, I may replace the wheels with some omni-wheels in the future. I have some ideas for the stereoscopic vision. Mostly I'm interested in having a 3D remote viewing experience. For that, I'll need some sort of viewer . I will also have to solve the charging problem. I'll probably start with the NXT Li-Ion pack . Then I'll have to build a dock. All in all, this project is just getting started. But, I'm excited to have a robotic platform that has full mobility in
Read more

Review of BioShock 2

BioShock 2 was a lot of fun. Rapture is even more artistically beautiful and intriguing than in the original. The world is full of details making for a constantly absorbing experience. The enemies are fun to fight and give you plenty of incentive and opportunity to experiment with different weapons and plasmids. Upgrading your character makes you feel powerful and the enemies make various satisfying noises as you dispatch them. The spear gun was great. Pinning enemies to walls is a lot of fun. With upgrades, it works like a sniper rifle. However, I found that the game suffers from poor collision detection at times which results in your long shots simply disappearing along the way. You quickly get the hang of dual wielding plasmids and weapons. Certain combinations are obvious and make the game quite easy. You may find yourself varying attacks just to keep it interesting instead of just trying to stay alive. I really liked the new research method which encourages you to try out mult
Read more

Outlet Mounted Phone Pocket

After looking at this project on Make  and realizing that I use that exact same shampoo, I thought I'd give it a try. It turned out pretty well. I decided to make my pocket deeper than the one on Make. However, I'll probably end up cutting it shallower because it's difficult to pull the phone out. As is, there's not enough clearance between the top of the phone and the plug without allowing for more angle when pulling it out. Another thing I did was use masking tape to layout the cuts instead of a marker. That worked quite well giving me nice straight lines and making it easy to revise my design several times before doing any cutting. Since I needed a European version, I couldn't use the provided template for the plug. Instead, I again used some masking tape to layout a square hole. First, I applied the tape in a square on the plug itself. Then I peeled it off carefully, stuck it on the pocket, and cut it out with a razor. It's a perfect fit. Update Cut
Read more

Browsing Android Source in Eclipse

This has been done before, but the way I set it up now is easier than other methods I've seen. Visit the Git site for browsing the Android framework source . Click the "tree" link next to the branch you want (e.g. Eclair, Donut, Cupcake, etc.) Click the "snapshot" link to download a tgz of the source for that branch. Create a sources directory in the associated platform directory of your Android SDK. For Eclair, it should be something like  ~/android-sdk-linux_86/platforms/android-7/sources (depending on where you installed your SDK). Extract the tgz to the new sources directory you created. Restart Eclipse and voila, you have browseable Android source code for your chosen platform. You'll need to repeat these steps for each platform you use as a target for your projects. As a bonus for making it to the end of this post, here's a summary of platform numbers, version numbers, and code names: Cupcake (version 1.5) is platform/android-3 Donut (v
Read more

ASE r22 Released

So, what's new? Features: Wake lock support added. It's now possible to have your scripts continue running when the phone tries to sleep. Location APIs now return location data from all available providers (i.e. network, gps, etc.) Wifi APIs added for scanning and retrieving access points. Added API for getting a list of all applications that are launchable via the launch API. Added support for launching scripts in the background from Locale. Changed callNumber API to automatically URL encode numbers (i.e. now it should "just work" ™) Bug fixes: Fixed general bugginess of Bluetooth support. No more deadlocks. Bigger rows in device listing. Fixed occasional activity hangs when network connections are poor. Fixed missing id field in error results. Fixed list results being returned as strings. Fixed Locale plugin. Fixed broken TTS support. Fixed broken sendEmail API. Fixed crash when importing incorrectly formatted scripts via QR code. Fixed race cond
Read more