Fields Summary |
---|
private static final String | TAG |
public static final String | BROWSE_ROOT_BASE_PATH |
public static final String | NOW_PLAYING_PATH |
public static final String | PIANO_BASE_PATH |
public static final String | VOICE_BASE_PATH |
public static final String | AUTHORITY |
public static final android.net.Uri | BASE_URI |
public static final android.net.Uri | BROWSE_URI |
public static final int | BROWSE_ROOT |
public static final int | NOW_PLAYING |
public static final int | PIANO |
public static final int | VOICE |
private static final android.content.UriMatcher | sUriMatcher |
public static final String[] | MEDIA_CONTAINER_PROJECTION |
private com.example.android.musicservicedemo.browser.MusicProvider | mMusicProvider |
private android.media.session.MediaSession | mSession |
Methods Summary |
---|
public void | onCreate()
super.onCreate();
mSession = new MediaSession(this, "com.example.android.musicservicedemo.BrowserService");
setSessionToken(mSession.getSessionToken());
|
public void | onDestroy()
super.onDestroy();
|
public android.service.media.MediaBrowserService.BrowserRoot | onGetRoot(java.lang.String clientPackageName, int clientUid, android.os.Bundle rootHints)
return new BrowserRoot(BROWSE_URI.toString(), null);
|
public void | onLoadChildren(java.lang.String parentId, Result result)
new Handler().postDelayed(new Runnable() {
public void run() {
final ArrayList<MediaBrowser.MediaItem> list = new ArrayList();
for (int i=0; i<10; i++) {
MediaDescription.Builder bob = new MediaDescription.Builder();
bob.setTitle("Title " + i);
bob.setSubtitle("Summary " + i);
bob.setMediaId(Uri.withAppendedPath(BASE_URI,
Integer.toString(i)).toString());
list.add(new MediaBrowser.MediaItem(bob.build(),
MediaBrowser.MediaItem.FLAG_BROWSABLE));
}
result.sendResult(list);
}
}, 2000);
result.detach();
|