Featured Posts

<< >>

StoryMap

ic_launcher

This is an app I am working on at the moment. I am making it for storymap.ie. It uses the new Google Maps API v2 and uses notification for playback controls. Stories can be streamed or downloaded beforehand. The app features rambles – Google Maps API is used to find optimal route between 2 points

VM Warfare

VM Warfare

VM Warfare is a multiplayer/singleplayer deathmatch game that won the Best Multiplayer Game award at GamesFleadh 2013. I created it together with Viktor Zolin, who made map editor and tile engine, while I mad emost of the game itself. You are a soldier defending the Earth against alien attack. To help you with this, helicopters

DIT Timetables

ic_launcher

An android app for DIT students to view their timetables. It downloads timetable data from web timetables and saves a local copy on user’s device. It lets user filter lectures and labs by group. DIT Timetable in Google Play Store

Notepad

ic_launcher

A simple app for saving notes. It was designed for Android 4.0 and newer, but support to older versions was added using ActionbarSherlock. It is very simple, but has some useful features, it detects links, allows pasting contents of clipboard into a new link, sharing notes using intents and receiving intents from other aps. It

Convoy Trucking

Convoy Trucking

Project website: www.convoytrucking.net. Community forums: www.forum.convoytrucking.net   This gamemode is my first and biggest project in Pawn. I started working on it in January 2010 and in two weeks created server called Convoy Trucking. To this day I continue working on it, and the community of players keeps growing. Some of the features included in

Notification buttons

Notification buttons

This tutorial shows how to make an audio playback service and how to control audio playback using buttons on a notification. I am going to assume that you have some knowledge of android app development, and know your way around Eclipse, or other SDK used for Android. This is my first tutorial, so please let me know in comments if anything needs to be explained in more depth, or point out any mistakes made.

1. Create service

First things first, we need to create the service that will play music. You can do that by creating a new class that extends Service. You will also need an instance of MediaPlayer. Your service should also implement OnPreparedListener and OnCompletionListener interfaces to receive callbacks from the MediaPlayer. Your code should look similar to this:

onCreate() is called when your service is first started. We’ll use it to instantiate the MediaPlayer, and set listeners. onStartCommand() is called every time you launch your service from an activity – this could happen several times during service’s lifetime. Returning START_STICKY causes your service to stay alive after onStartCommand() finished executing.
You should also define your service in your project’s manifest. Put the following between the <application> tags:

2. Let’s play some music

Now that we have the service, let’s make it play the music. We will modify onStartCommand() to handle the incoming intent, and override onDestroy() to stop the music when service is stopped:

This will get the url from intent and use it as a data source for media player. You can use this to stream media from the internet. the prepareAsync() method starts buffering the audio stream in a secondary thread, and will call onPrepared() when finished – that’s where you start playback by calling start() on the MediaPlayer.

If you want to stream music from the internet, don’t forget to request the INTERNET permission inside the <manifest> tags of your manifest:

Next we’ll create an Activity (you should know how to do this) that will start the service. Add 2 buttons the layout: first button will start the service and play music, while the other one will stop the service:

The code above will start the service with url link provided. It should start streaming Radio Nova. The app should work at this stage. Go on and try it!

3. Show the notification

The final part of this tutorial is creating the notification that will show when service is running and present user with playback control buttons. Let’s create a showNotification() method inside our Service. The notification will have Stop and Pause Buttons. You can add buttons by addAction(). We should also define the broadcasts for those buttons.

We will use NotificationCompat class from the support library for building the notification so it’s backwards compatible. If you want you can use the Notification class, however it’s not recommended.

To make my life easier, I made the createPendingIntent() method to create broadcast pending intents easy:

startForeground() method will bring your service to the foreground by showing the notification.

Notification should be shown whenever new stream is played:

Now all that’s left is handling the button presses. To do that, we need to create a BroadcastReceiver, register it inside onCreate() method, and unregister when service is destroyed:

At last, we should implement the onCompletion() method. It is called when song finished playing. In my implementation it simply stops the service:

That’s it! You can now test the app. When you start the audio, you should be able to see this in your notification shade:

Notification buttons

Of course, the app is a bit rough around the edges; the “pause” button doesn’t turn into “play” when you press it, but I will leave this as an exercise for the reader.

Full source code:

Edit distance algorithm

This little algorithm is one of the coolest things I learned from the programming lectures with Dr Bryan Duggan. Essentially this algorithm shows how much one word needs to be edited to change into another word. It is very useful for writing a spellchecker, or a music recognition app. Below is a C# implementation of the algorithm:

the getEditDistance() method returns 0 if both words are equal, 1 of one letter needs to be changed, etc.

StoryMap

ic_launcher

This is an app I am working on at the moment. I am making it for storymap.ie. It uses the new Google Maps API v2 and uses notification for playback controls. Stories can be streamed or downloaded beforehand. The app features rambles – Google Maps API is used to find optimal route between 2 points with stories in-between. The rambles are automatically downloaded from server, but user can create their own ramble by specifying the start and end point. It also handles storymap.ie links, so they open in the app instead of web browser. It’s designed to look clean and be easy to use.

StoryMap

Notification is shown while story is being played back.

Notification is shown while story is being played back.

Notification shows download progress

Notification shows download progress

Sudoku

I made this little program to test my sudoku-solving algorithm around the christmas time. I used XNA to draw the puzzle, and solving algorithm works in a separate thread (included below). This is not the best algorithm since it can’t solve “hard” puzzles. But it can logically deduct numbers (no guessing) and put them in the right place.

sudoku

SudokuSolver.cs:

HTML Editor

I remember making this program back in 2004. Still, I was very surprised today when I started it and noticed how developed it is. It has an awful lot of features for something that I knew I would not use anyway. Obviously it doesn’t offer syntax highlighting but has other useful features for novice web designers, like html templates. It allows to easily add html tags and has color pickers. Unfortunately no source code.

The readme.txt file reads:

Aplikacja do edycji stron HTML. Nie obsluguje
kolorowania skladni, ale posiada wbudowane
szablony znaczników. w kazdym razie jest
nieco lepszy od standardowago notepada :)

Which basically explains that it’s a simple program, but still better than windows notepad.

HTMLed