Android gets music information from third-party music players

Source: Internet
Author: User

Get music information for third-party music players recently in doing Android phone. At first, it was so hard to collect information from third parties, and then read the blog post about how to listen to the music of the system, and found that when the next piece of music was broadcast, the broadcast would contain the next piece of information.

The music player of the Android system will send:

Com.android.music.metachanged

How do I Get music information from third parties?

First anti-compiled QQ music apk, find it about the player's service, found that the use is "com.android.music.metachaged"


Next is Kugou, every day beautiful, chin listening

Com.kugou.android.music.metachangedcom.ting.mp3.playinfo_changed

The tangle of things appears to be analysis of shrimp, multi-meter, Kuwo time

Shrimp latest version in the anti-compilation times wrong, people do anti-anti-compilation, although the online search how to crack, but a little trouble, stay behind to learn. The high version does anti-decompile, but when you're low, the technology isn't so good. I made a low version, and sure enough, the anti-compilation succeeded, found "com.xiami.meta_changed." Although can get to this broadcast, but people do not put the data in the broadcast, it in the acquisition of the broadcast time to call the method of acquiring music, this code to write tangled, to this step there is no way to engage.


Both DOM and KUWO do not send broadcasts, and the methods they handle are callbacks, so neither of these can be obtained.


The code below is the code that collects third-party music information

       Intentfilter IF = new Intentfilter ();        if.addaction ("com.android.music.metachanged"); &nbs P       if.addaction ("com.android.music.playstatechanged");        if.addaction (" Com.android.music.playbackcomplete ");        if.addaction (" com.android.music.queuechanged ");         if.addaction ("com.htc.music.metachanged");        if.addaction (" Fm.last.android.metachanged ");        if.addaction (" com.sec.android.app.music.metachanged ");         if.addaction ("com.nullsoft.winamp.metachanged");        if.addaction (" Com.amazon.mp3.metachanged ");        if.addaction (" com.miui.player.metachanged ");        If.addaction ("com.real.IMP.metachanged");        if.addaction (" Com.sonyericsson.music.metachanged ");        if.addaction (" com.rdio.android. metachanged ");        if.addaction (" com.samsung.sec.android.MusicPlayer.metachanged ");        if.addaction ("com.andrew.apollo.metachanged");        if.addaction (" Com.kugou.android.music.metachanged ");        if.addaction (" com.ting.mp3.playinfo_changed ");         Registerreceiver (new Playerreceiver (), IF);
You need to add information to the Playerreceiver inside the radio.

String albumname = Intent.getstringextra ("album");                String artist = Intent.getstringextra ("artist");                String trackname = Intent.getstringextra ("track");                String Xiaminame=intent.getstringextra ("Widget_song_name");                System.out.println ("The Playing album Name:" + Albumname + "Artist:"                + artist + "Track:" + trackname+ "Xiaminame:" +xiaminame);                String artistname = Intent.getstringextra ("Notify_artistname");        String audioname = Intent.getstringextra ("Notify_audioname");

In the end, the above methods cannot get through, and some third parties ' music information is not available.

There is another way to do this, and when playing music, the music player sends a notification that contains information about the current music. This way need to add the capture code inside the Systemui, catch the specific notification, then the screen to take the word? Need to continue the study.

After this analysis, it is not a good thing to find out how much radio is used, it is easy for others to get the data.



Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.