Earlier, using boundService this could be easily achieved. But with MediaBrowserService I can't access getDuration outside, without which I am unable to update the seekbar.
How do I call getDuration in mediaBrowserService from an Activity?
1.1k Views Asked by V1 Kr At
1
There are 1 best solutions below
Related Questions in ANDROID-SERVICE
- How to know when the services has ended
- Service stop doing its job after removing app from recent apps list
- android check location services enabled if using GoogleApiClient
- My service seems to restart when I close my app
- Broadcast not being received Android
- How to use alertDialog in background service
- How to send data from IntentService to Non-Activity class
- android -Can't create handler inside thread that has not called Looper.prepare()
- Alarm receive don't work
- Independent time tracking in android app: service or asynctask?
- AsyncTask is not running when called with execute
- Starting Activity With Intent Flags Stops Service After It Starts
- Android Service vs Simple class with thread for network access
- Android is killing my service?
- Update UI with background service
Related Questions in ANDROID-MEDIAPLAYER
- Strange picture noise at the beginning of live stream
- How to get a thumbnail of a live stream?
- Different sound on each button
- Android several MediaPlayers
- Only play rtsp video using VideoView or MediaPlayer after 3 minutes or more
- Android MediaPlayer playing sound ok on virtual device and on tablet, but intermittently on smartphone galaxy s iii mini
- How to use a MediaPlayer Singleton
- Handle MediaPlayer exceptions from throwing infinite errors
- Calling prepare() after stop() on MediaPlayer throws IllegalStateException
- Can an Android (Java not C/C++) plugin alter unity textures?
- Beginner android help playing audio from within a runnable
- Notification using RemoteViews not working
- Media Player: error (-19, 0)
- Media player not playing mp3 files in android 2.3
- Update progressbar in Gridview
Related Questions in ANDROID-SEEKBAR
- How to change Brigthness from Window manager View?
- Storing seekbar values after drag drop process end in ListView
- How to Scroll Image Horizontally in Android and Get Input From User?
- Can not add SeekBar to MediaPlayer.
- set style of seek bar
- Fill in Android SeekBar
- Nearest step seekbar discret
- Exoplayer seekbar does not work with arrow keys
- Why seekbar tick marker shown in front of thumb?
- Seekbar in listview returns first and last positon
- Multiple Activities with one XML File
- Popup AlertDialog with a seekBar to change app volume
- How to control media player with SeekBar
- How to set seek bar thumb position in the following link
- How to make numeric seekbar with Material Design
Related Questions in ANDROID-MEDIASESSION
- MediaControllerCompat memory leak
- Cannot get an instance of MediaSessionManager with getSystemService()
- Android communication between MediaPlayer and SeekBar in MediaSession Architecuture
- Media3 ExoPlayer notification artwork overlaps previous ones
- In Android MediaSessionCompat.Callback onSeekTo() how to detect event is from the notification player
- How to get the player variable from MediaSessionService example in docs?
- How to use the new AndroidX Media2?
- MediaBrowserService quick-fired twice by MediaButtonReceiver?
- Starting up the media2 MediaSessionService causing some random crashes (using MediaController and ExoPlayer)
- Android Auto media app - How to change custom action icon
- Android media buttons not working while activity is not visible
- Android App web based html5 Music Source used with cordova -plugin-music-controls2 but no controls or music info on lock screen
- Background Execution Limits and foreground service getting killed
- remove active song from media session in android
- Android emulator not receiving media button callbacks
Related Questions in MEDIABROWSERSERVICE
- MediaBrowserCompat.connect() never calls onConnected or any MediaBrowserCompat.ConnectionCallback method
- How to resolve leak at androidx.media.MediaBrowserServiceCompat?
- MediaDescription.Builder() not setting MediaItem Icon
- Android Automotive OS not displaying playable MediaItem's
- Refresh Media in Android Auto MediaBrowserService
- MediaBrowserServiceCompat: Context.startForegroundService() did not then call Service.startForeground()
- MediaBrowserService vs MediaPlayer to play wave files on Android
- MediaBrowser not connecting to MediaBrowserService
- How to use Android's MediaBrowserService to serve MediaStore songs?
- MediaBrowserService with ExoPlayer and PlayerControlView - How to access to the player instance from the UI (PlayerControlView)?
- leak canary detects memory leak in MediaBrowserServiceCompat sample app
- The app did not appear in the Android Auto screen when we attempted to test functionality
- Refreshing MediaBrowserService subcription content
- MediaBrowserService and MediaStore
- How do I call getDuration in mediaBrowserService from an Activity?
Trending Questions
- UIImageView Frame Doesn't Reflect Constraints
- Is it possible to use adb commands to click on a view by finding its ID?
- How to create a new web character symbol recognizable by html/javascript?
- Why isn't my CSS3 animation smooth in Google Chrome (but very smooth on other browsers)?
- Heap Gives Page Fault
- Connect ffmpeg to Visual Studio 2008
- Both Object- and ValueAnimator jumps when Duration is set above API LvL 24
- How to avoid default initialization of objects in std::vector?
- second argument of the command line arguments in a format other than char** argv or char* argv[]
- How to improve efficiency of algorithm which generates next lexicographic permutation?
- Navigating to the another actvity app getting crash in android
- How to read the particular message format in android and store in sqlite database?
- Resetting inventory status after order is cancelled
- Efficiently compute powers of X in SSE/AVX
- Insert into an external database using ajax and php : POST 500 (Internal Server Error)
Popular Questions
- How do I undo the most recent local commits in Git?
- How can I remove a specific item from an array in JavaScript?
- How do I delete a Git branch locally and remotely?
- Find all files containing a specific text (string) on Linux?
- How do I revert a Git repository to a previous commit?
- How do I create an HTML button that acts like a link?
- How do I check out a remote Git branch?
- How do I force "git pull" to overwrite local files?
- How do I list all files of a directory?
- How to check whether a string contains a substring in JavaScript?
- How do I redirect to another webpage?
- How can I iterate over rows in a Pandas DataFrame?
- How do I convert a String to an int in Java?
- Does Python have a string 'contains' substring method?
- How do I check if a string contains a specific word?
On the MediaBrowserService, when you're updating the MediaMetadata, add the duration of the current media.
While on the client side, using MediaBrowserCompat you're able to connect to you MediaBrowserService and retrieve a MediaSessionCompat.Token. With the token you can then get a MediaSessionController from where you can get the MediaMetadataCompat that has information about the current media.
The official documentation has an ok explanation on how this works a whole