Monday, September 19, 2011

Metro UI 2.0 Application Counts

As of version 0.0.3 developers can now update application counts for their apps.  Below is a quick tutorial on how.

This example shows how to update application counts in Metro UI 2.0.  The example we will be using is updating the count of the default "Phone" tile.  First, you will need to make sure you have requested permission to update application counts by adding the following "uses-permission" tag to your applications manifest file:


<uses-permission android:name="chrisman.android.home.metroui2.UPDATE_TILE_PERMISSION" />


Once you have permission, you can send intents by doing the following:


Intent i = new Intent();
i.setAction("chrisman.android.home.metroui2.UPDATE_TILE_INTENT");
i.putExtra("chrisman.android.home.metroui2.NAME_EXTRA", "com.sec.android.app.dialertab.DialerTabActivity");
i.putExtra("chrisman.android.home.metroui2.PACKAGE_EXTRA", "com.sec.android.app.dialertab");
i.putExtra("chrisman.android.home.metroui2.COUNT_EXTRA", MissedCallCount);
getApplicationContext().sendBroadcast(i);


Basically what this is doing is sending a message to Metro UI with the identifying application information (Package and Name) along with the count you want displayed.

Pretty easy, huh?  If you have questions or need further clarification, let me know.

No comments:

Post a Comment