Questions tagged [mediabrowser]

18 questions
13
votes
2 answers

How to set EXTRA_PAGE and EXTRA_PAGE_SIZE in a MediaBrowserServiceCompat by getting reference to the Android Auto MediaBrowser?

I have an Android Auto app. I would like to take advantage of pagination for browsing within the app. It seems that you can set EXTRA_PAGE and EXTRA_PAGE_SIZE by getting a reference to the MediaBrowserCompat and passing those constants in…
9
votes
2 answers

MediaBrowserServiceCompat receiving empty bundle when item is clicked

I am trying to expose media items to other media apps that can browse my app's content through my MediaBrowserServiceCompat service. In my onLoadChildren method I am constructing MediaBrowserCompat.MediaItem with a MediaDescriptionCompat that…
Ziad Halabi
  • 964
  • 11
  • 31
5
votes
0 answers

In MediaBrowserService.onLoadChildren, when/how is the options bundle supplied?

In MediaServiceBrowser or MediaServiceBrowserCompat, there are two methods: public abstract void onLoadChildren (String parentId, Result> result) and public void onLoadChildren (String parentId, …
5
votes
2 answers

How to stop MediaBrowserServiceCompat?

My service: public class MusicService extends MediaBrowserServiceCompat { ... } My Activity: public class MediaActivity extends AppCompatActivity{ private MediaBrowserCompat mMediaBrowser; @Override public void onCreate(Bundle…
3
votes
1 answer

MediaBrowser not connecting to MediaBrowserService

I'm trying to connect to a MediaBrowserService from an activity using a MediaBrowser. However, my onConnected callback never seems to be called to allow me to set up the MediaController and start manipulating playback. In my player/browser…
2
votes
0 answers

How to access SimpleExoPlayer instance inside MediaBrowserServiceCompat with PlayerControlView?

I have been trying to build an audio podcast app in which I need one feature of playing audio that should show in the notification bar/ lock screen just like any other music app. For that, I have used SimpleExoPlayer for media, and PlayerControlView…
2
votes
1 answer

Why is connectionCallback.onConnected() not called when connecting to mediaBrowser?

I'm just setting out with teaching myself about Android audio development, and I'm rather baffled as to why neither the onConnected nor the onConnectionFailed method of connectionCallback is called here. PodcastService is instantiated and its…
2
votes
1 answer

Android Auto: paginating a MediaBrowserService by passing extras options bundles fails

Recently, I've been trying to implement pagination on the Android Auto part of my application. To do so, I took inspiration from this Medium post. This question is also related. However, I am still stuck: while I can make the code from the Medium…
2
votes
3 answers

MediaBrowserCompat.connect() never calls onConnected or any MediaBrowserCompat.ConnectionCallback method

I am trying to connect my activity to a MediaBrowserServiceCompat service using MediaBrowserCompat. This is my activity: @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); …
1
vote
1 answer

Grant read access to FileProvider to any client app without knowing their package name

In the context of a MediaBrowserService for audio playback I need to provide image files via a ContentProvider (FileProvider). The URIs are propagated via meta data related to media browsing and playback. There are no Intents involved. I need to…
1
vote
0 answers

How to control music playback on the phone from WearOS watch

I want remote control phone music playback from WearOS watch just for play/pause/next/previous as system app does. I have google a lot, building a media browser client in WearOS app looks right to implement this. val comp =…
1
vote
0 answers

Using Single instance of MediaBrowserCompat for entire of app with Dagger 2

I created multiple instances of MediaBrowserCompat in activities and fragments in my app and in this situation every component must create MediaBrowserCompat and connect it to service and so on. For make simpler, Is it a bad idea to use Dagger to…
Amir Hossein
  • 313
  • 1
  • 2
  • 13
1
vote
1 answer

Fatal Exception: java.lang.IllegalStateException in MediaBrowser

My audio streaming app have this issue in Crashlytics, with the stacktrace below Fatal Exception: java.lang.IllegalStateException: getExtras() called while not connected (state=CONNECT_STATE_CONNECTING) at…
ChinLoong
  • 1,735
  • 24
  • 26
0
votes
0 answers

How to resolve leak at androidx.media.MediaBrowserServiceCompat?

Leak is : 19583-19583/com.example D/LeakCanary: ​ ┬─── │ GC Root: Global variable in native code │ ├─ android.service.media.MediaBrowserService$ServiceBinder instance │ Leaking: UNKNOWN │ Retaining 1.3 kB in 12 objects │ this$0 instance of…
0
votes
1 answer

MediaMetadataCompact getRating

In my media app, I keep all the media items as MediaBrowserCompat.MediaItem I'm adding a rating to these items. To read the rating from a MediaItemCompact, Android provides public RatingCompat getRating (String key) what is the key parameter ? and…
1
2