Remote control your (now) headless Android phone

Last night a terrible thing happened, I dropped my Razr Maxx and shattered the screen. In its defense, I have dropped it on many occasions, including (accidentaly) throwing it across a concrete garage (face down), and kicking it into a wall (from bed). Without even a scratch on the screen, it has withstood my abuse like a champ, but last night it just couldn’t handle the sharp jagged rocks that broke the screen.

Sometimes people get lucky, and even though the screen is shattered, its still usable, (albeit, touch sensitivity probably sucks after that). If that was my case… I wouldn’t have anything to write about. No… my screen no longer turned on. So now what?

Remote control it! It is an android after all (pun intended).
Heres what we need:

First thing I did was start up the Android Screencast java program. This little program detected my plugged in phone and immediately brought up my screen. Apparently  if you have a rooted device, you can also send clicks from the program. Unfortunately, my device was not rooted.

In order to send commands to your phone, you are gonna need to use the Android SDK. Once you have it installed, find the platform-tools folder, cd into it, and run:

 ./adb shell

That should bring you into a shell command to which you can send commands to your phone.

ADB Shell
shell@cdma_spyder:/ $ input
usage: input ...
input text
input keyevent
input tap
input swipe

My first challenge was getting past my lock screen. I have a PIN number, which I was easily able to enter using the command:

input text 1234

Then, came the more challenging part: hitting the submit button. In order to submit my PIN, I had to guess/determine the X Y coordinates of the enter button, and send a tap via:

input tap 350 750

Remember that the Android coordinates screen starts at the top left. So, (0,0) is the top left, (MaxX, 0) is the top right, (0, MaxY) is the bottom left, and (MaxX, MaxY) is the bottom right.

In order to get the Notification Window, I had to swipe down:

input swipe 350 0 350 700

Another neat trick is sending KEYCODES via the

input keyevent

command. You can find a list of KEYCODES here. I particularly found

input keyevent 3

useful, which is the Home button.

Backing up my SMS messages

Luckily, I was able to navigate through Android, launch my SMS Backup program, and backup everything I needed, eventually transfering them all to my computer.

Energy Datapalooza 2012

So I thought I’d talk about my recent trip to Washington D.C. to attend the Energy Datapalooza conference. First thing I noticed in D.C. was this: the Metro system there is really nice. I mean really, really, nice. Cleveland’s RTA system could surely take a leaf out of D.C.’s book when it comes to the cleanliness of its stations.But I digress, the conference was very interesting. It started out like this: waking up at 6 in the morning and trying to not to look like a zombie. Getting to the conference was easy (see above: the Metro there is nice!).

Who is that dashing young man on the left? Oh! Thats me!

Ok ok, the conference. It started out with some really great talks, I especially enjoyed the one by the Found and CEO of WattzOn, Martha Amram. WattzOn has definitely got some good stuff going on, and a new app they just released that helps you choose new appliances that are both low-cost and energy efficient. There were quite a few good talks, and then Secretary of Energy, Dr. Steven Chu, gave a great speech on how there is such a large market of energy related applications that are just waiting to be developed.

[embedplusvideo height=”300″ width=”430″ standard=”http://www.youtube.com/v/cspiqloXVP4?fs=1″ vars=”ytid=cspiqloXVP4&width=430&height=300&start=&stop=&rs=w&hd=0&autoplay=0&react=0&chapters=&notes=” id=”ep7301″ /]
Oh, and you see the back of that kid’s head on the right side of the video? Thats me too!

There was also an award ceremony for the Apps For Energy contestants, where we were invited onto the stage to shake Dr. Steven Chu’s hand and get our picture taken.

Ok, so after all the presentations, we went up to the 4th? floor and setup our table. I think we took the prize for the most screens on a single table, 2 phones, two tablets, and my laptop (my gorgeous Retina Macbook Pro). Various people walked around checking out the displays. I got to talk with a lot of people and demonstrate our application. Even Martha Amram (WattzOn) stopped by and gave me her business card (which I was excited about). We definitely got some great feedback, so now its a matter of incorporating those suggestions into our application and releasing an update. When your one of two programmers, that can definitely take some time, but I’m working on it!

 

Update 10/8/2012:

Another video surfaced about the Energy Datapalooza.
[embedplusvideo height=”300″ width=”430″ standard=”http://www.youtube.com/v/CIgpX1lgPj0?fs=1&start=53″ vars=”ytid=CIgpX1lgPj0&width=430&height=300&start=53&stop=&rs=w&hd=0&autoplay=0&react=1&chapters=&notes=92%7eThere+is+the+back+of+my+head+again!” id=”ep6974″ /]

Java’s Quirky Modulus

When it comes to them modulus operator, Java can be kinda quirky. Consider the statement:

a % b

If “a” is negative, the result will be negative. On would expect that -1%12 would return 11, as it does in Python. You can get this desired behavior in Java by doing:

(a % b + b) % b

I definitly wasted 5 minutes  debugging this, but at least now I know.

Reference: http://stackoverflow.com/questions/4412179/best-way-to-make-javas-modulus-behave-like-it-should-with-negative-numbers

Energy Datapalooza

It’s hard to believe that only a few months ago, my team and I won second prize in the Student Division of the Apps For Energy Contest. It still hasn’t quite sunken in yet… we won a national competition….that is just amazing. One of my teammates was talking about it to a friend during a car ride (late Chinese food run), and she was totally amazed. Me?… I was amazed at her amazement. Did my team really just place in this national competition? I still feel like the same person. The whole thing just seems so surreal, like it was all a dream.

As a winning team, we have been invited to Washington D.C. to attend the “Energy Datapalooza”, with a booth demonstrating our application. I just got this in the mail, which drives home the impressiveness of what my team has achieved. I’m really proud of my team, but we have a lot more to accomplish before we can rest.

ENERGY DATAPALOOZA
Unleashing the power of data to advance our energy futureThe White House Office of Science and Technology Policy, Council on Environmental Quality, the U.S. Department of Energy, and the U.S. Environmental Protection Agency cordially invite you to join us for an “Energy Datapalooza,” highlighting innovators and entrepreneurs who are using freely available data from the government and other sources to build products, services, and apps that advance a secure and clean energy future.

Monday, October 1, 2012
8:30 am – 2:00 pm

Eisenhower Executive Office Building
South Court Auditorium
Washington, D.C.

Special Guests:

Steven Chu
U.S. Secretary of Energy

Todd Park
Assistant to the President
U.S. Chief Technology Officer

Bob Perciasepe
Deputy Administrator, EPA

Nancy Sutley
Chair, White House Council on Environmental Quality

Heather Zichal
Deputy Assistant to the President for Energy and Climate Change

A Faster Android Emulator on Mac (Android 4.0.3 “Ice Cream Sandwich”)

If you have ever tried developing for Android on the Mac, you will know its painstaking slow. I run an iMac i7 (Hyper-threading) with 16GB of RAM, and I find myself grabbing a beer whenever I am using the Android emulator. Until now, I haven’t cared too much about the lack of speed (Hint: Beer). But recently I have been emulating a lot more devices, including tablets. I stumbled upon a Stack Overflow article which described possible ways of improving performance, and found out there is an Intel System Image for Android 4.0.3 (Ice Cream Sandwich).

Everything has been slow on my computer because I have to emulate an ARM processor, but thankfully there exists a version of 4.0.3 that is for Intel. This system image will allow you to run 4.0.3 natively on your Intel based Mac. Unfortunately, there is no Jelly Bean Intel System Image yet, but I can hope. In order to use this emulator, you can follow the steps below to install it:

 

Step 1

Open up the Android SDK Manager, and brows for “Intel Atom x86 System Image” under Android 4.0.3
Note: There is also one for Gingerbread under 2.3.3 if you want to run Gingerbread natively too.

 

Step 2

Download the “Intel Atom x86 System Image
Optional: Grab a beer, cause you won’t have an excuse the next time you launch the emulator

 

Step 3

Navigate to downloaded file:
<Android SDK Location>/extras/intel/Hardware_Acceleration_Execution_Manager/
and open the IntelHAXM.dmg file

 

Step 4

Running the .mpkg, and make your selection on how much RAM to use. You can always change your mind later by re-running the installer.

 

Step 5

Open the AVD Manager in Eclipse, and create a new Device. Select “Android 4.0.3 – API Level 15” as your Target, and choose “Intel Atom (x86)” as your CPU/ABI.
Under “Hardware” add the “GPU Emulation” property, and set it to “yes”. Make sure to have “Snapshots” unchecked. Its GPU Emulation or Snapshots, take your pick.
Fill out any remaining fields you wish.

 

Step 6

Launch the Emulator, and cry a little on the inside about how much less beer will you be drinking. Your wallet thanks you.

Budget It Yourself wins 2nd Place in Best Student App! [Update]



BEST STUDENT APP SECOND PRIZE: BUDGET IT YOURSELF

Location: Cleveland, OH

The Budget it Yourself app is a collaborative project from a team of students at Case Western Reserve University and the Cleveland Institute of Art. The app helps users track their energy usage and make energy-savings goals.

Well, it was just announced today that my team’s app won second place!

This is a great achievement for me, and will no doubt further me interesting in mobile development. As one of the requirements perks of winning, we have to keep the application free for one year, and I plan on making multiple updates and improvements along the way.

I want to give a great big thanks to Robert Karam and Patty Ni, my team members for helping make this possible. I look forward to working with them as we continue to develop Budget It Yourself. You can checkout the full announcement at http://energy.gov/articles/first-round-apps-energy-winners-announced-today

[UPDATE]

We are now on the front page of the Cleveland Institue of Art website! Direct Link: http://www.cia.edu/news/stories/bma-student-cwru-partners-take-prize-in-app-contest