Cyanogen Platform SDK
The CyanogenMod Platform SDK provides a set of APIs that give you easy access to a variety of different features within CyanogenMod. The SDK exposes APIs and system level framework access in Android.
The initial set of APIs included in the SDK include:
- Quick Settings Tiles API
New APIs are to be added as the SDK evolves.
Adding a Quick Settings Tile
You can use the
CustomTile.Builder to create a tile to be displayed in the Quick Settings pull down menu. Your tile should specify a
PendingIntent to be invoked when the tile is tapped. Your intent could do something like launch an activity or broadcast to a receiver so you can handle the action in the background.
Here is some sample code for building a tile:
// Unique ID for this tile (so we can publish updates to it) var customTileId = 23; // Create a pending intent for when the tile is tapped PendingIntent pendingIntent = PendingIntent.GetBroadcast (this, 0, someIntent, PendingIntentFlags.UpdateCurrent); // Create the tile var customTile = new CustomTile.Builder (this) .SetOnClickIntent (pendingIntent) .SetContentDescription ("Generic content description") .SetLabel ("CustomTile") .SetIcon (Resource.Drawable.ic_launcher) .Build (); // Publish the Tile CMStatusBarManager.GetInstance (this) .PublishTile (customTileId, customTile);
If you publish a tile with the same tile id as a previously published tile, it will replace it with the updated tile. This is useful for changing your tile state such as when it is meant to be toggled.
For more information, view the Platform SDK Java Docs