04 Dec, 2009

How-To: In-App Announcement System

Posted by: jamesj3k In: Development

Adding an in-app announcement system to your app is an excellent way to “Apple-proof” your app. With 2-4 week approval times, having an instantly changeable notification system is the best way to reliably reach your users.

Let’s say your app was just approved and you find out it has a terrible bug in it.  How are your going to inform your users of the workaround while you wait weeks for Apple to approve your update? Or, what if you just launched another app and you want to do a cross-promotion?  If you think ahead and spend a little effort upfront, you can avoid 1-star reviews and achieve effective real-time communication with your users.

In our most recent game, Depict, we decided to implement such a system.  Since Depict is a multiplayer game, we anticipated needing to announce server down-time or other unforeseen issues.  He’s how you can add the same system to your app in under an hour…

We used cocos2d for our app, but this method could easily be adapted for other presentation schemes. Our system shows a notification banner at the bottom of the title screen which may also link to a web address.

First, create a banner named banner.png and upload it to your website.  Here’s an example:

thanksforplaying

Next, create a text file named notification.txt and upload that too.

When your title screen initializes, use a synchronous ASIHTTPRequest to load the text file. If the file contains the word “none”, we’re done.  Otherwise, save the string for later and use another ASIHTTPRequest (asynchronous) to load the banner image.  When the banner finishes loading, turn it into a button and display it on-screen.  In the button handler code, check to see if the string we saved from the text file is a URL and if it is, navigate to it. That’s it!

download code snippets

Tags:

2 Responses to "How-To: In-App Announcement System"

1 | mister t

December 7th, 2009 at 8:27 am

Avatar

I would recommend putting the synchronous request in another thread, since it will lock your GUI (or loading process in this case).

Better would be to use a asynchronous request and initialize your app for the ‘none’ situation.

Besides that you’re trying to retrieve a file less than 32 kb. This means that ASIHTTPRequest can’t track the progress of the download (see docs), which means that the time-out of the request doesn’t work. Instead the time-out value will be 75 seconds ( the standard time-out of CFStream). For more information search the google group of ASIHTTPRequest for ‘time-out 32kb’.

Of course these problems only matter when the user has a very slow connection or a low quality connection (high ping values).

2 | James

December 7th, 2009 at 8:42 am

Avatar

That’s a good point. I wasn’t aware of that fact. I think we’ll be ok for now since we have connection checks that run before this to see if the user can reach our server.

Comment Form

About

Makeshift Games is an independent game development studio located in Seattle, WA.