Header Ads

Develop app extensions for the “WALKMAN” Music player infinite button with the new Sony add-on SDK


Do you have an app or service around music? Or maybe you run a music store app, an artist information site, an artist oriented app, a fan site or something similar? Then you can develop an app extension for “WALKMAN” music player, using the Music Infinite API available in the Sony Add-on SDK that was launched last week. In the “WALKMAN” music player app, the Infinite button can be used to access related information, content and services about the song or artist currently being played.
When you press the Infinite button, a list of apps becomes visible in the menu. Information is then sent to the app you select in this list. Xperia™ devices already come with a few pre-installed “WALKMAN” music player extension apps for the Infinite button, such as Wikipedia™ and YouTube™. And with the Music Infinite API, you can make your own app appear in the list. The extensions will be fed the data of the song currently being played as a Uniform Resource Identifier (URI) to the current song.

A list of available apps shows up when you press the Infinite button.
New use cases, more visibility
If you develop an app extension for the Infinite button, you can add a lot of value and get a lot of visibility to your app or service as it will show up to all users tapping the Infinite button. The Infinite button provides your app with the URI (uniform resource identifier) to the content currently played. Essentially, this means your app or service is provided with information to do whatever you want related to that song, text, artist, author and so on. This also leaves you with a lot of room to innovate and create exciting new apps and services!
The “WALKMAN” music player app with the Infinite button is available in basically all Xperia devices, which makes it a way to gain visibility for your app.
Get started
To start developing an app using the Music Infinite API, install the Sony Add-on SDK, then download the Sony Add-on SDK documentation kit, which contains a guide to the Music Infinite API . The Music Infinite API documentation describes how to develop your app extension, as well as how to verify your application using the music player emulator provided in the Android™ SDK manager.
In the Sony Add-on SDK kit, there is also a code example, to help you get started with your extension for the Infinite button. Let’s take a look at the basics of how it works!
First of all, you need to register and connect your app to the “WALKMAN” music player app. When the “WALKMAN” music player app is started, it sends the “com.sonyericsson.media.infinite.ACTION_GET_DETAILS” broadcast intent. Your extension application must implement a broadcast receiver that receives that broadcast intent and returns a string which describes the extension and the package.
To receive the broadcast intent from the “WALKMAN” music player app, you need to add the receiver to your Android manifest:





Secondly, to handle the intent when the “WALKMAN” music player app starts, you add the following code to your broadcast receiver (called ExampleExtensionReceiver in the code example included in the Sony Add-on SDK):
@Override
public void onReceive(Context context, Intent intent) {
  ...
  // Build a URI for the string resource for the description text
  String description = new Uri.Builder().scheme(ContentResolver.SCHEME_ANDROID_RESOURCE).authority(context.getPackageName()).appendPath(Integer.toString(R.string.description)).build().toString();
  // Store package and description info
  extras.putString("com.sonyericsson.media.infinite.EXTRA_DESCRIPTION", description);
  // Pass back the package and description as a result
  setResultExtras(extras);
}
When you have done this, your app will be connected to the Infinite button. But to make sure that something actually happens when the user clicks your extension in the Media Infinite list, your extension application must contain an activity that filters and launches on the “com.sonyericsson.media.infinite.ACTION_VIEW_INFINITE” intent. As extra data, the intent must have the mime type “audio”, since only audio data is supported “WALKMAN” music player app. This is set in the manifest with the following code:







Once this is handled, you can go ahead and build the activity that should handle the intent that is received from the “WALKMAN” music player app. From the intent, you can get data such as track title, artist, album and more about the track that is playing.
Intent intent = getIntent();
// Retrieve the URI from the intent, this is a URI to an audio file
Uri trackUri = intent.getData();

...

//Extracting some data from the URI
Cursor trackCursor = getContentResolver().query(trackUri,new String[] {MediaStore.Audio.Media.TITLE, MediaStore.Audio.Media.ARTIST,MediaStore.Audio.Media.ALBUM}, null, null, null);
That was all you need to do to add an extension for the Infinite button to your app. The final step is to make your extension searchable and visible, and how to do this is described below.
Make your extension searchable to increase visibility
To increase the visibility of your app on the applicable devices, make sure that your extension is visible on all devices that support it. This is an example of how you can add a uses-library tag to the Android manifest:

To make your extension searchable, remember to include the string “Music Infinite Extension” somewhere in the Google Play™ description text.
Now you can go ahead and create your own “WALKMAN” music player extension apps for the Infinite button! For more information, check out the Sony Add-on SDK section on Developer World. If you have any questions, drop us a line below. And feel free to tell us about your apps, we’d love to hear what creative uses of the Infinite button you can come up with!

No comments:

Powered by Blogger.