[Xamarin Blog] Lock Screen Music Controls in Xamarin.Android

JamesMontemagnoJamesMontemagno James MontemagnoUSForum Administrator, Xamarin Team, Developer Group Leader Xamurai
edited January 2014 in Android

Just posted: Lock Screen Music Controls in Xamarin.Android on the Xamarin Blog.

Read the full article to learn how to up enhance your music streaming Xamarin.Android app by adding lock screen transport controls and artwork.

Use this thread to discuss or ask questions.

Posts

  • PerCramerPerCramer Per Cramer NLMember, University

    Hi,

    i tried it, but nothing shows up in my lockscreen. Should i change some system settings? The device is running Android 4.2.1

    Regards,

    Per

  • ChristopherDrososChristopherDrosos Christopher Drosos GRMember
    edited August 2014

    im wondering if i can add custom buttons on the lock screen such as play audio file from next or previous audio category. is this possible?
    also you are making some broadcast recievers in the folder recievers and those recievers are not mentioned on mainactivity or in the service. android is going to use them either way?

  • JamesMontemagnoJamesMontemagno James Montemagno USForum Administrator, Xamarin Team, Developer Group Leader Xamurai

    Not as far as I know. Each phone can theme it differently.

  • carleslscarlesls carles lloret ESMember

    ups the blog link is broken.
    Thank you anyway.

  • JamesMontemagnoJamesMontemagno James Montemagno USForum Administrator, Xamarin Team, Developer Group Leader Xamurai

    @carlesls which link?

  • carleslscarlesls carles lloret ESMember

    Is it possible to use the lock screen controls to do other things like playing a very simple spaceship game while listening to music...
    Is it possible to customize the locked screen with a layout?
    Is it intelligent to initialize or update the lock screen from the service that initializes and updates the notification bar?
    Thank you.

  • carleslscarlesls carles lloret ESMember
    edited December 2014

    What about a ProgressBar or even a SeekBar inside the lockscreen... is it possible??
    Or even something unrelated to a player or music... then should I use the audiomanager??
    How do you do that?
    Thanks again.

  • ChristopherDrososChristopherDrosos Christopher Drosos GRMember
    edited December 2014

    from my understanding you can only change and use the actions from the lockscreen (playnext, forward, playpause, stop etc) and also you can change name,artist, album image
    you cannot modify the interface.

    James, it would be nice an update for the lollipop because Lock screen widgets are gone and now we have to use notification shade controls

  • JamesMontemagnoJamesMontemagno James Montemagno USForum Administrator, Xamarin Team, Developer Group Leader Xamurai

    I will be updating my Nexus 7 device to lollipop when I get back home in a few weeks and will take a look at it.

    And you are correct about what you can and can not put on the lock screen. The RemoteControlClient handles this: http://developer.android.com/reference/android/media/RemoteControlClient.html

  • sizeaksizeak Simon Jackson USMember

    Sorry to necro the thread but I think the example is missing a call to AudioManager.RequestAudioFocus. Until I added this I could not get the lock screen to show the controls.

  • AlexvanMeertenAlexvanMeerten Alex van Meerten NLMember

    Hi @JamesMontemagno
    Did you manage to get the Music Controls working on the lock screen for Lollipop?

  • Martijn00Martijn00 Martijn Van Dijk NLMember ✭✭

    @AlexvanMeerten Take a look at: https://github.com/jamesmontemagno/AndroidStreamingAudio/blob/master/Part 3 - MediaSessionCompat/Services/MediaPlayerService.cs

    That works with the new media style notifications and has support for lock screen controls!

  • AlexvanMeertenAlexvanMeerten Alex van Meerten NLMember

    @Martijn00: that looks promising, thnx!

Sign In or Register to comment.