Developing a Music Streaming Android App

streaming logicchip 1

For creating a audio streaming in android you must be aware of some things. Mainly database,web service,json array,php things like that. This project can be tricky. However Wamp is used as the server for php and database. Advantage of using php is it’s very easy to setup and test. Android support streaming defaultly. Only need to set type AudioManager.STREAM_MUSIC in MediaPlayer object.

MediaPlayer mediaPlayer = new MediaPlayer();

Here a tablayout is used for category selection. Here we use 6 tabs Blues, Electronics, Folk, Hip Hop, Jazz, Pop and Rock. For database connection we use web services the server side code is in php. Only one fragment is used for all the 6 tabs, changing content according to the tab. Inorder to use web services we need a network library called volley, Add this dependencies in the build.gradle(Module:app) file

dependencies {
compile ''

Also add internet permission in Androidmanifest.xml.


1. Creating Database

Download wamp or xamp server and install it. Create a database called song in it a table called audio.

streaming logicchip 2

Now create a folder called song in the www directory of wamp or xamp whatever you are installed. Another folder called songs inside song to store your music files in there. Example a.mp3, b.mp4 etc. Add those names to the database also.

streaming logicchip 3

If wamp or xamp don’t run properly check Internet Information Service(IIS) Manager in windows. Also check privileges.


2. Php files for web service

Need two php files like.php and song.php. The song.php file is for finding and viewing songs. The like.php file is for rating the audio file.


For song.php we must provide a tag. Tag for the category of songs to be selected and displayed.


For like.php we must provide id and value of rating. Updated rating can be positive or negative.


3. Android part

Class files for android part are, and MainActivity holds the fragments and tabs. Also it’s where the streaming take place. for holding the constants. for fragment class and a page adapter class for the tabs.

Class file contains clicks for streaming audio. Load streaming audio list and display  it.

Adapter for viewing songs is inside the class, It uses an xml file for Ui.


fragment_comn.xml which contains methods for streaming


You should replace the ip address with your wamp server running systems ip. Streaming requires ip or link for working. While using a local system ip is our best option. Don’t use “localhost” us ip. Streaming works by loading a link and retrieving it’s content. By using a localhost android try to access it which is not possible, because it’s not have any servers running. Wamp is the server running so we need to use the ip of the system. In case it’s hosted online server. We can use links like “” .







Pause button used for pause streaming audio.



Play button used for start streaming.

2 comments on “Developing a Music Streaming Android App

  1. Hello good morning, I am writing to you from Peru, do not list or reproduce anything, could you share your code with me, thank you

    1. It appears that i have lost those related to music streaming app, all that remain is the content of this blog.You can recreate the entire app by using this blog post.

Leave a Reply

%d bloggers like this: