Have you ever wondered what music other persons in your town are listening to? SpotiTrace gives you the answer to that question. The Android app makes it possible to see what nearby SpotiTrace users listen to on Spotify right now and you can also choose a location anywhere in the world and find users there. Start following a user and continue listening to the same songs as the other user.
There are many different ways to find other users in SpotiTrace. This page explains all the features of the app.
When you start the SpotiTrace app you are asked to login using your Spotify account. You need a Spotify Premium account if you want to use all of the features in SpotiTrace.
After login a BroadcastReceiver is started in order to receive the broadcast notifications sent from the Spotify app whenever you start a new song. These notifications include information about the song you are listening to (name, artist, Spotify URI). The URL to the album cover image is fetched from the Spotify Web API before all the information is uploaded (using JSON) to the SpotiTrace server together with a token that associates the information to a specific user.
When you have logged in, your location will be sent to the SpotiTrace server and a list of nearby SpotiTrace users and what songs they are listening to is returned by the server. The users are shown in a list sorted by distance from your position.
You can start listening to the same song as another user by clicking on a user in the list or by shaking the phone to select a random user from the list. The song is started in the SpotiTrace app in a Spotify player developed using the Spotify Android SDK.
Swipe down to update the list of users. The list will also be updated when the track ends, so that the app gets information from the server about what to play next. The next song of the user that you follow will be the next song played on your phone.
A user can be marked as a friend by clicking on the star. All your friends (including friends that are not nearby) can easily be found by clicking on My Friends in the menu. The list of friends works in the same way as the nearby users list.
If you open the menu, you can find the number of users that follow you right now by looking at the number to the right of Who follows me?. Click on Who follows me? to see their usernames and how far away they are. You can also mark a follower as a friend to include the user in your list of friends by clicking on the star next to the username.
Location Search can be used to choose a location anywhere in the world and find SpotiTrace users there. When you press the button New Location, Google Maps is opened in the SpotiTrace app. A long click on the map is used to choose a location. The latitude and longitude of the selected position is sent to the SpotiTrace server and a list of users close to that position is returned by the server. The list of users works in the same way as the nearby users list, which means that you can start listening to the same songs as a user on the other side of the world.
The list of users returned by the server also includes the distance to the user from your position and the bearing (direction from you to the user). This information is used for the Compass Search.
The compass in the phone is used to know in what direction you are pointing your phone. Press the button Find new user to check if there is a user in that direction. The compass data is compared to the bearing for the different users and one user is returned if there is at least one match close to the direction the phone was pointed. Both the distance and the bearing are used to determine the best match if there are multiple users in the direction. The song played by the user returned from the server is automatically started in the SpotiTrace app.
Near Field Communication (NFC) can be used to choose user that you want to follow. Click on NFC Connect in the menu and touch your phones together. Both users will see the Touch to beam view (see image to the right). The user that is going to decide what songs both users will listen to, touches the screen and his/her user IDis sent to the other phone.
The phone that received the user ID sends a request to the server to get information about the user (username, distance) and what song the user is listening to right now. The song is automatically started in the SpotiTrace app.
The following list shows all our goals for this project:
Worst-case scenario
Best-case scenario
All goals except one of the best case goals were accomplished. Listen to the same songs in sync with another user is difficult since the server delay is not constant. Instead, we decided to build a custom Spotify player integrated in the SpotiTrace app, which was not part of the original plan.
It has been a fun project and we have learned a lot. Developing both the Android part and the server part (using Ruby on Rails) of SpotiTrace was interesting since it gave as a overall picture of how a JSON API is used for communication between Android apps and servers. We decided to use one MainActivity and many different Fragments when developing the Android app, which worked well. Many sensors have been used, and especially NFC (Near Field Communication) was interesting to learn more about. We also decided to spend much time on the design since we think a good design is important to get a good impression of an app.
The project has been successful and we have many ideas for further improvements of the app in the future. One good feature would be to be able to save songs to a playlist in Spotify.