You can also use the following command line instructions, which match the previous snippets:Īdb shell am broadcast -a -e track "Torn" -e artist "Natalie Imbruglia" -e album "Left of the Middle" -e scrobbling_source "" -el position 1 -ez playing true adb shell am broadcast -a -e track "Torn" -e artist "Natalie Imbruglia" -e album "Left of the Middle" -el position 30000 -ez playing false -e scrobbling_source "" the values for position and duration are expressed in millisecods with a Long type.the "duration" parameter is very important as well, because it allows to precisely identify the right lyrics for that song.as a consequence to the first note, the "scrobbling_source" extra is used to identify the source application (i.e., your app).the action "" corresponds to the same action that is used by default on Android rather than creating a custom action for every player, it is better to stick to this one.However, there are a few points worth noting: The snippets are pretty self-explanatory. tAction("") īundle.putLong("position", 30000L) // 0:30īundle.putBoolean("playing", false) // currently playing tAction("") īundle.putString("artist", "Natalie Imbruglia") īundle.putString("album", "Left of the Middle") īundle.putLong("duration", 245000L) // 4:05īundle.putLong("position", 1L) // beginning of the songīundle.putBoolean("playing", true) // currently playingīundle.putString("scrobbling_source", "") Īnd this is a sample intent for the same song, which has been put to pause at 30 seconds: This is how the intent for a "new" song should look like: Let's see how to create a sample intent for these events. Package name of the application that sends the Intent (String) Playback status of the current track (Boolean, whether is playing or paused) The current playback position of the track (Long, milliseconds) The following list contains all the extra fields that the Intent must contain:ĭuration of the current track (Long, milliseconds) The playstate has changed, indicating that a playback event has occurred (play/pause, seek, stop, next/prev. The metadata has changed, which typically means that a new song is now playing Basically, FloatingLyrics™ reacts to these two events: Enabling FloatingLyrics™ for your application is fairly straightforward, as it is entirely controlled via broadcast intents.
0 Comments
Leave a Reply. |