Skip to content

Commit

Permalink
Create car
Browse files Browse the repository at this point in the history
  • Loading branch information
mhajr7022 authored May 28, 2023
1 parent c2406d5 commit 2582ad5
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions car
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@

1 comment on commit 2582ad5

@TIJBRAND1996
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

public class MediaPlaybackService extends MediaBrowserServiceCompat {
private MediaSessionCompat mMediaSession;
@OverRide
public void onCreate() {
super.onCreate();
// Create your MediaSessionCompat.
// You should already be doing this
mMediaSession = new MediaSessionCompat(this,
MediaPlaybackService.class.getSimpleName());
// Make sure to configure your MediaSessionCompat as per
// https://www.youtube.com/watch?v=FBC1FgWe5X4
setSessionToken(mMediaSession.getSessionToken());
}
@OverRide
public BrowserRoot onGetRoot(@nonnull String clientPackageName,
int clientUid, Bundle rootHints) {
// Returning null == no one can connect
// so we’ll return something
return new BrowserRoot(
getString(R.string.app_name), // Name visible in Android Auto
null); // Bundle of optional extras
}
@OverRide
public void onLoadChildren(String parentId,
Result<List<MediaBrowserCompat.MediaItem>> result) {
// I promise we’ll get to browsing
result.sendResult(null);
}
}

Please sign in to comment.