Tuesday, May 15, 2012

Android Cloud to Device Messaging (C2DM)

It is easy to do "pull" from Android (or anything). Just use an http request. What about "push"? How do you send a message to your phone? There is the Cloud-to-Device-Messaging API. (Sure you can have a thread to periodically listen for messages intended for your phone too).

The link above is nice. It tells you the nuts and bolts but alas, where are the simple examples? There are complex over bloated examples in there. I want something simpler and to the point!

This gentleman wrote a lot of great examples for a lot of things: Lars Vogella's C2DM Tutorial.

There are many examples out there too. But they want to use the Unix curl command. I am in Windoze, Ok?

Everyone just have to put chunks of code but not runnable simple code, and even if you follow exactly there are got-chas.

Here are the steps.
1) First, you'll need a google account and sign up for C2DM, and provide your package name like com.mycompany.myapp

2) In your app, set up the manifest with all sorts of permissions as shown in the google c2dm link. You need a C2DMReceiver class that handles registration and messages sent to you.

3) To send message, you need 3 things.
1. Register on the phone to get a registration String from the C2DM Handler.

The 4 lines seen in google c2dm link works wonders. You need to somehow have the phone communicate this back to the sender application. (Vogelle send this to himself with http Post) I just System.out.println and captured it. You can probably send a email to yourself or something (silently).

2. An authorization ID from google ClientLogin given your google login/password, the form action is https://www.google.com/accounts/ClientLogin

Account Type:

See that Auth ID? copy it.

3. The message itself, of course

4) Now you can write a separate program to send message to your phone with the 2 IDs above and the message. Vogelle's MessageUtil work well. I added this method, and run the class as a command line app.

 public static void main(String args[]) {
  String auth_token="...";    // you supply yours here (step 3.1)
  String registrationId="..."; // you supply yours here (step 3.2)

  String message="something";
  if (args.length>0) {
  int status=0;
  try {
  status = sendMessage(auth_token,registrationId,message);
  } catch (Exception e) {
  System.out.println("Done sending, status="+status);
5. Final note, if you see an error in logcat saying something like the following:
ERROR/TalkProvider(232): java.lang.IllegalArgumentException: the bind value at index 2 is null
Turn off your google talk on your phone. Apparently google is using google talk as the way to send message to your phone.

Thursday, May 10, 2012

No more menu button

This may be old news. Google says no more menu button.

Yes, menu items can still be accessed via that vertical dot-dot-dot. I do like the menu button more.

Modern versions of Android seems to be harder to navigate. I played around the tablets and new phones. Intuitive and simple are the winning elements of the Apple products. I think google should keep it simple.

Monday, April 23, 2012

Friday, April 20, 2012

Vocabulary List revisited

Vocabulary List is one of my 3 original apps I published about a year ago.

Get Vocabulary List here.

This is a great app to carry a list of vocabulary to study where ever you go. Log new words, quiz yourself. At the $1 price tag, there are very few downloads. Everyone (including me) wants free stuff.

I want this to be useful for students! Now it is free:
Get Vocabulary List Lite here.

The $1 version now has an additional feature to import/export lists to your gmail account. You can send yourself a pipe-delimited vocabulary|definition list you crafted on your computer and then study on your phone.

Tuesday, April 10, 2012

Visual Math Quiz

In America, we test kids every year and say they FAIL. Yes, many of them do fail. They don't know their stuff expected at their grade. But we never bother to teach them well in the first place.

There are poor teachers. There are problems at home. There is little motivation.

We test them but we don't go over test with them. Why are old Iowa Test/ACT/SAT with answers and explanation not given to kids so they may learn what they did wrong? After all, the whole point of education is learn?

Here is the Visual Math Quiz of basic arithmetic. I may make it a series to cover math topics beyond basic arithmetic.

Why is it easier to learn the basic operations if you WATCH a teacher do it on the board? That's because the teacher can do it one step at a time. Sure, you can tell the teacher to do another example, but the teacher can only do so much. So, the calculator can do this, but it doesn't show you the steps.

How about you enter 2 numbers and select an operation and see it carry out the steps.

How about clearing up the confusion of integer arithmetic in number line demonstration. See, adding means count to the right, subtraction means count to the left.

Get yours here

Tuesday, March 27, 2012

Days Since Revisited

Days Since is my most popular app, with 4000+ downloads. This app is remarkably simple: it is a simple list that you add/change/delete items.

Many comments say the widget is UGLY. Sorry, it looks fine to me. Yes, that background image can be a bit better but I have no tools to make it so. I am not a graphics artist.

That days counter is sometimes one day off. It is calculated by relying on Java's calendar library to tell me how many milliseconds has passed (between midnights) of the dates, and that can be a little off. I attempted to fix it.

Added a couple more easy-to-implement features: font size, and Send option so you can send yourself a CSV file of your data.

For a much more feature-packed version, with categories and past/future tabs, see the Event Reminders app.

Thursday, January 19, 2012

Parking Reminder

This convenient tool lets you put a reminder of how much time you have before your parking meter expires. When there is 5 minutes or 10 minutes left you will get Notifications and a vibration. It also sends 1 more notification when it is expired.
Get yours here from the Android Market