Android obtains the music information of a third-party music player.

Source: Internet
Author: User

Recently, I am working on an Android phone to obtain the music information of a third-party music player. At first, it was a headache. It was too difficult to collect third-party information. I read the blog post about how to listen to the music playing information of the system, it is found that the broadcast will be sent when the next music is played, and the broadcast will contain the next piece of information.

The Android music player sends the following message:

Com. android. music. metachanged

So how can we get the music information of a third party?

Decomcompiled the Apk of QQ music, found its service about player, and found that it uses "com. android. music. metachaged"


Next is Kugou.

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

What's tangled is the analysis of Xiami, duomi, and Kuwo.

Xiami's latest version reports an error in the decompilation process. People do anti-decompilation. Although I searched the internet for how to crack it, it is a little troublesome and I will keep learning later. Anti-decompilation is performed for the higher version, but the technology is not so good when you are in the lower version. I got a lower version and found "com. xiami. meta_changed '. Although the broadcast can be obtained, but people do not put data in the broadcast. When it gets the broadcast, it calls the method of getting music. This code is tangled, in this step, we cannot proceed.


Both duomi and kuwo do not send broadcasts, and their processing methods are callback, so neither of them can be obtained.


The following code collects third-party music information:

       IntentFilter iF = new IntentFilter();        iF.addAction("com.android.music.metachanged");        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 in broadcast processing in playerReceiver.

 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 method cannot be obtained, and some third-party music information cannot be obtained.

In addition, the music player sends a notification that contains information about the current music when playing the music. In this way, you need to add the capture code in systemUI, capture the specific notification, and then take the words on the screen? Further research is required.

After this analysis, we found that it is not a good thing to use more broadcasts, and it is easy for others to obtain data.



Related Article

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.