Discussion on Blappy Bird Source Code - Android Studio Project

26 comments found.

Hi, is there a way to keep both Banner & Interstitial Ads ?? I seen a comment above where you said to add Interstitial Ads , “remove” the banner ads…....I would like both ad platforms if possible. Also would it be possible to add a leaderboard ? Thanks…...

Hi there, currently there is no leaderboard in the app as it requires connecting to your own google play account, or to run your own server. Probably the easiest way to put a leaderboard in is to use the Google Play Games leaderboards, you can read about it here: https://developers.google.com/games/services/common/concepts/leaderboards.

I might look at putting one in in the future, but I’ll have to think about it as the setup for the end user would be more involved.

I have studied your documentation on how to add sound (mpg.3, ogg’s) but I want to loop a background music mpg3, I am able to add it as a sound, but it starts at the start of the game and again when the bird dies so it is playing over itself. How can I begin playing the background music at start up, and it stop automatically when the bird dies? Then repeat the same process, on at start up, off when bird dies. Thanks for this really cool app, one of the best I have purchased on here, and you have been so helpful.

Hi there, thanks very much for your kind words. Glad you like it. Sure that is definitely possible, though adding background music is slightly different to adding sounds. For background music I would recommend using the android MediaPlayer class.

I made some instructions for adding background music to the app, here:


These instructions will start the music when the user starts a new game or when the app starts, and pause or stop the music when the bird dies.

Hope that helps. If you get stuck please do let me know. Thanks again, Steve

hi can you plese add chartboost ad network? i will buy then..

Hi there, hmm I am not sure about putting this in the main release, but it can be done as a custom job no problem.

Hi, please check your email. I wanted to buy this game with few changes.

Hey! Nice job! I just wanted to know what do I need to change in the code so that my bird dont die when it hit the ground, but at the same time that the ground is still visable? :)

Hi there, Ok open up Wall.java file in Android Studio and find this line (Ctrl+F will find it for you):

y = rnd.nextInt((mCanvasHeight – groundHeight) – 500) + 300;

There are 3 of these lines identical, one on line 91, one on line 153 and one on line 229.

Change the numbers 500 and 300 on those 3 lines to change the max heght and min height of the walls. You will have to play around a bit with these numbers to get the height you want. If you increase the 300 number I think that will move the gap towards the centre of the screen more.

All 3 lines should have the same values.

Thanks! Here you can check my app.. https://goo.gl/L5k7FZ

Fantastic! Great job, well done!


unxavi Purchased

Hi mate,

I am finding a bug and I am not sure how to solve it. When you run the game, play once and hit game over, that you have the “play” button, if in that moment I hit the android home button and then I reopen the app with recent apps button, the resolution gets all mess up, everything looks bigger and you cannot press the play button again (actually the button is in one place and the touch area in another).

I have try with your demo APK and it does not happen. I try with a fresh install without changing anything on the code and it happens. I can reproduce in my physical Nexus 6 phone with API 24 and on an Emulator Nexus 5x with API 23.

Any hints? can you reproduce?

Hi there, hmm ok let me investigate. What is your compileSDKVersion in the build.gradle file? If the demo APK is fine, maybe reduce the compileSDKVersion number to a lower version and see if it makes a difference. I will have a look shortly and let you know ok..

Hi, thanks for spotting this. The solution is to open up the GameView.java file, and find this line which will be around line #176:

holder.setFixedSize(720, 1280);

and replace it with this:

holder.setFixedSize(width, height);

I will upload this update to codecanyon with the updated code asap. Thank you so much!


unigroup Purchased

Have recently purchased from you and overall very happy with the game. I have run into an issue that is only relevant to tablets (as far as i can tell). I changed the game speeds and jump distances using your guide and all works perfectly on android phones however when you install the same APK onto a tablet the jump distance changes are exagerated to the extent it makes the game unplayable. I’m Using Android Studio v2.2.3 and everything is up to date – I generate the signed APK without errors and installs fine on phones but its just when installing on tablets that the issue occurs (tried both samsung 7 inch running Jelly Bean v4.2.2 and 10.1 inch samsung running Kitkat v4.4.2. Have you come across this before and/or can you advise how this can be fixed?


unigroup Purchased

Yes they are: Samsung Galaxy Tab 2 7 inch – 600×1024 pixels (170 ppi pixel density) Samsung Galaxy Tab 4 10.1 inch – 1280×800 pixels (149 ppi pixel density)

Thank you very much. I have found the issue only occurs on tablets classed as mdpi pixel density, which both of yours are. The quick fix is to:

1. Open the file BirdSprite.java file in Android Studio

2. Find this piece of code, which is around line 84:

DisplayMetrics displayMetrics = gameView.getResources().getDisplayMetrics();
float dpHeight = displayMetrics.heightPixels * displayMetrics.density;

3. And replace those two lines with this code:

DisplayMetrics displayMetrics = gameView.getResources().getDisplayMetrics();
float density = displayMetrics.density;
if (displayMetrics.density == 1.0f) {
density = 2.5f;
float dpHeight = displayMetrics.heightPixels * density;

Where it says “density = 2.5f”, you can change this number to suit jump distance for mdpi tablets to your liking. Probably somewhere in between 2.0f to 3.0f would be ideal.

I will work on putting this into the release code. Thanks!


unigroup Purchased

Thank you – this has resolved it