Android Minimum Required SDK

If you are unsure what should be the minimum required SDK for your new Android application, I suggest you take a look at the Android Developer Dashboards. It has a pie chart and table that shows you the number of Android devices that have accessed Google Play within a 14-day period.

As of this writing, you should really support Android 2.2 (Froyo) because it has 12% of the market. Going one level down to Android 2.1 (Eclair) gives you another 3.7%. There is little reason to support Android versions lower than 2.1.


Testing Android Notification PendingIntent

So you’ve followed the Creating Status Bar Notifications in the Android DevGuide. You got the notification icon and ticker to appear on the status bar. In case you haven’t, here’s a code snippet.

NotificationManager nm = (NotificationManager) getSystemService(Context.NOTIFICATION_SERVICE);

Notification notification = new Notification(R.drawable.icon, "ticker...", System.currentTimeMillis());
notification.flags = Notification.FLAG_AUTO_CANCEL;

PendingIntent pendingIntent = PendingIntent.getActivity(this, 0, new Intent(this, MyActivity.class), 0);
notification.setLatestEventInfo(this, "title...", "text...", pendingIntent);

nm.notify("tag...", 0, notification);

Note the code snippet above is more concise, and also automatically cancels the notification when the users selects it.

So how do you test the PendingIntent in your emulator? Those new to Android development would logically think that clicking on the notification icon in the status bar will call the PendingIntent Activity. However, the notification icon is not clickable. In the Android 2.x emulator, just like in the real mobile device, you would need to drag the statusbar down to see the notifications. You can also do it the long way by clicking the “Menu” button, and it will display the “Notifications” option.

Click on “Notifications” and you will get a list of notifications. Click on the one you created to trigger the Activity.