BBC Radio 1 – Now Playing

BBC Radio 1 – Now Playing

During the recent weeks, I had some time to take another look at the Android Studio. I have to admit that it took my a long time to finally switch from the eclipse environment to the Android Studio. But now that I’ve done it, I don’t really want to go back. But the main reason to develop this app was that I’m an avid listener of BBC Radio 1. It’s the only radio station I really listen to while I’m working for school and so I come across many songs I really like. The problem is, that most of the time, I can’t find the tab in the browser in time to find how the son is called. (This may sound strange but when my desk is full of school stuff its already hard to find the mouse…) So I wanted to make a small app, which shows me the current song and its artist. I also wanted to make it as simple as possible. It should be my first app made in the Android Studio as well.

Getting the data

I started with finding the right data source. I played around with the BBC Radio 1 Web Player and found some pages that provide the current artist and song as JSON-data. So after that I started a new project in the Android Studio. I knew that I would have to do some async/sync calls to get the data, so I immediately added these two dependencies:

After that, I started with transforming the data into java objects. This worked really good and so I then worked on the layout of the app.

Layout

layoutThe most important thing in the layout for me was the cover of the CD. In my opinion, it’s just the easiest way to remember the song. I wanted to display the current show too because sometimes I just want to know if there will be some special guests coming to the show. This information is usually in the description of the current event (on the Web Player), so it didn’t take me long to find it in the JSON-data.

But I came across a problem to display the album cover in a stock ImageView. But I knew that there was a nice library which would make this much more easier. This library is called ION (GitHub). And it’s really easy to use as well. The following snippet shows, how I just have to give it the ImageView-object and the URL to the image:

Ion.with(imageView)
       .placeholder(R.drawable.ic_launcher)
       .error(R.drawable.ic_launcher)
       .load(dataService.getNowPlayingImageUrl(realtime.getRecord_id()));

I have to admit, that I was lazy and didn’t create some more interesting placeholders.. But that’s a task for another day. The rest of the layout consists of just normal TextViews and a LinerLayout which is filled with a black background and acts like a divider between the two pieces of information.

Widget

2015-03-15 13.09.12After I finished with the main application I used it for a few days and I was quite happy with it. But I then started to check the application more regularly and I thought that I could do a widget too. This would make checking the current artist far easier and I haven’t developed a widget before. So I started to work on that new challenge. The page that helped me the most with the development was the official android sdk guide. You can find that here: android-sdk-widgets

The one problem I had was that normally widgets only reload their data every half an hour. And this isn’t really what I was looking for, as the data changes approx. every 4 – 5 minutes. So I googled around and came across the best solution for this problem: Alarm Managers. I worked with that and created the class AppWidgetAlarm. You can check this out in the repository to see how it works in detail.

Future

I won’t upload the app to the Play Store, mainly because the source of the data isn’t from me. But I published the code to GitHub, to help others when they work with one of the mentioned libraries or when they want to see how I did the widget. Maybe there are people, who just want to build the application to enjoy the benefits of always knowing which song is on.

I will continue to enhance the app though. I hope that the Google Now Card API is getting public soon. It would be nice to integrate it there as well. I sometimes get an error when the app runs too, so there is some bug-fixing to do. I think there is something wrong with the parsing, but it is working in like 99% of all cases so it’s hard to debug. Another thing I might want to add its the actual radio stream. But this isn’t something that easy I think, but maybe another challenge for a rainy weekend, who knows. Let me know what you think of it.

Link to the repository on GitHub: https://github.com/mrwonderman/BBCRadio1-NowPlaying

“Strom und Spannung” version 1.1.0 release

I’m finally releasing a new version of the “Strom und Spannung”‘s app this evening. Finally I managed to make a complete translation of the app. I had to guess a lot of the tecnical words, but I think it’s alright. If you find something, please tell me :).

Some other new features are:

  • Much better unified UI
  • Calculation of the resistance when the temperature changes
  • Many user enhancements

You can get the newest version here: https://play.google.com/store/apps/details?id=net.yscs.android.stromundspannung

Recording to my awkward roadmap, there will be a small update in a week or so for bugfixes. But the new major update won’t hit the play store until mid august. I’ve got some big topics I want to include into the app and make it available to tablets. But let’s see :).

At this point I really want to recommend the lint markers. You can right click on your android project and choose the following sub menu:Screen Shot 2013-06-10 at 21.16.08
This will show you parts of your code that you can improve. This really helps to keep your code clean and avoid some UI-Bugs.

“Strom und Spannung v1.0” release today

ic_launcher-web

This morning I finally released my calculation application about current and voltage. I know there are a lot of other applications that can do this too, but I wanted to publish the application. I think the application is very basic but okay. Another thing is, that I developed the whole application in German.

A lot of things changed since I last published an application, and the tutorial got even longer: http://developer.android.com/tools/publishing/app-signing.html

The main reason I developed the app was that I wanted to work with the new Navigation Drawer. Take a look at it in the following screen:

device-2013-05-26-100047This Navigation Drawer replaces my former tab-layout perfectly. And it’s really easy to implement. Take a look at the following sites:

http://developer.android.com/design/patterns/navigation-drawer.html

http://developer.android.com/training/implementing-navigation/nav-drawer.html

But a least there is one good thing, the code of my app  is opensource, so you can check it out yourself and feel free to download the app in the play store.

https://github.com/mrwonderman/stromspannung

https://play.google.com/store/apps/details?id=net.yscs.android.stromundspannung