Quitting your game without killing the Android process

I’m back with a small article on how to improve Android Cocos2D-X based games. To quit an Android game when pressing Back, the engine sample tells you to call

  Director::getInstance()->end();

Now this the job in most cases, but has one major drawback: it doesn’t follow Android guidelines for finishing an Activity. Instead, it kills the whole Linux process hosting the Android game. This has implications if your game includes Android services (eg. for push notifications), because it kills the service as well. Therefore, your push notifications will not work properly.

So I had to come up with a fix. I implemented this C++ function which calls a native Java method:
Continue reading Quitting your game without killing the Android process

Entrepreneurship attempts (Take 1)

Ever since high school I kinda knew I wanted to do stuff for myself. In fact, many of my classmates made various apps under make-believe company names – Waspsoft, Cavrom etc. They weren’t actually sold anywhere, just bragged about around the high school.
My first big thing was a fake Telnet client to collect email passwords around the computer lab. This was in 1995-1996, so I wrote it in Pascal. Yes, I was phishing back then, but that term wasn’t coined until much later :). It was a relatively innocent idea, meant to “Tinder” people by writing fake love letters from one another. I was so proud I even showed it to my programming teacher. He just said “You’d be better off focusing your energy on doing good stuff”.
Continue reading Entrepreneurship attempts (Take 1)

monocube: resurrection

It’s been more than 4 years since I updated my blog. During this time, I quit my (highly paying) job as a software architect, I got married (yes, developers do have a life :), and learned a lot. About life, software and business. For any ambitious person, learning should never stop.

This is what my blog is about. I will share my struggle to become financially independent (as in, not working for “The Man”), the decisions (good, but mostly bad) and what I learned from them.

Hopefully they will all help someone.

Disclaimer: I’m not financially independent, I still have a part time job as a software engineer. But I’m closer to that goal than I was 4 years ago, as I have a relatively small, but steady passive income. I will get to that in my next posts.

Building san-angeles and hello-gl2 samples from Android NDK

Recently I started playing with the Android NDK. Looking at the included samples, I stumbled upon a native compilation problem (using the latest Android NDK Revision 8b):
compilation failed for hello-gl2 and san-angeles:

Compile++ thumb : gl2jni <= gl_code.cpp
D:/Work/Apps/android-ndk/samples/hello-gl2//jni/gl_code.cpp:22:23: fatal error:
GLES2/gl2.h: No such file or directory
compilation terminated.
make: *** [D:/Work/Apps/android-ndk/samples/hello-gl2//obj/local/armeabi/objs/gl
2jni/gl_code.o] Error 1

Searching around, I found others with the same problem, but no clear solution. However, the problem is quite simple: Google forgot to include the Application.mk file for these samples.

So to fix it, you need to create Application.mk, or copy an existing one from another sample. You will need to set the APP_PLATFORM inside it to the one used by the Java project. Check the AndroidManifest.xml file for each sample (ie. )

Here’s my Application.mk for hello-gl2:

# The ARMv7 is significanly faster due to the use of the hardware FPU
APP_ABI := armeabi armeabi-v7a
APP_PLATFORM := android-5

For san-angeles it’s this:

# The ARMv7 is significanly faster due to the use of the hardware FPU
APP_ABI := armeabi armeabi-v7a
APP_PLATFORM := android-4 

Please note that for OpenGL 1.x, the minimum platform is android-4; for OpenGL 2.x, it’s android-5.

UPDATE: I was testing the OpenGL samples, but it seems others fail as well:
native-audio (set android platform to android-9 – at least)
native-media (set android platform to android-14 – currently maximum included platform in NDK)

UPDATE 2: It seems there’s also an open issue at Google for this:

I updated it with the solution:

Issue 36133: ndk-build.cmd does not work

I hope this helps.

Code snippet: Get all User installed apps on Android

In App List I needed to get the list of all user installed apps. So I made this little utility function:

	public List<PackageInfo> getInstalledPackages()
	{
		List<PackageInfo> allPackages = getPackageManager().getInstalledPackages(0);
		List<PackageInfo> installedPackages = new ArrayList<PackageInfo>();
		for(PackageInfo p : allPackages) //parse all packages to remove the ones with "System" flag
		{
			if(!((p.applicationInfo.flags & ApplicationInfo.FLAG_SYSTEM) == ApplicationInfo.FLAG_SYSTEM)) //package is not marked as "System"
			{
				installedPackages.add(p);
			}
		}
		return installedPackages;
	}

I hope this helps.

AdMob mediation tests

As of now I’m running some AdMob Mediation integration tests for Tapjoy, AppBrain, Madvertise and Leadbolt. So far it seems to work ok – with one mention being Leadbolt. If an ad is being displayed by this Network, it creates an Ad which obscures the other Ads. In other words, AdMob can’t destroy this Leadbolt ad, and the upcoming ads can’t be seen. I can’t seem to get a reference to the LeadBolt ad so I can pass it to AdMob for destruction. That’s a pity, I have to find a workaround.

I’ll let you know how it works 😉

Quick Android Income Report : 4 months since startup

I’ve been late with this report, mainly because of my other daily activities. In short, ever since I introduced ads and the point system in Power Schedule, Power Schedule Basic and App List, I managed to get enough money to pre-order (thanks to a friend in UK) a Google Nexus 7 tablet (Yay!). Unfortunately I will receive it later in August, when my friend from UK will visit Romania.

It’s not bad, but I can’t quit my job just yet. Some friends of mine actually make a nice passive income from other types of sources. Try, for example, online poker. There are many such services online, but they use Partypoker. It works for them. Since I’m a developer, I’m just trying to do what I know best: develop :).

Anyhow, the short breakdown is as follows:
LeadBolt income: $10
AdMob income: $6
TapJoy income: $242
Sales from SlideME: 7$
Adsense on monocube.com: $7
TOTAL: $272

Overall, I would say Tapjoy is working. Some users do like “incentive advertising”, while others not. Leadbolt and AdMob (banner based) ads are not so well suited for my apps, as they are “fire and forget” kind of apps (users rarely open them after installation). I’m currently working on some updates for all apps, I will try to use AdMob’s mediation service in conjunction with other advertisers (LeadBolt, Madvertise, AppBrain). Maybe I’ll also sign up with other AdMob Mediation approved advertisers as well (however I’m trying not to dilute the earnings between too many advertisers, since it may delay my checks by a while :).

Android App fragmentation

Well Android fragmentation is one thing. However for me the most severe one is app fragmentation. Take a look at the below screenshot from Power Schedule Google Play statistics. The lime line is currently the 1.5 version. Orange is the 1.6 line, while the others represent the 2.x versions. The blue ascending line is the latest version, 2.1.2 – this seems to have a steep update rate, which is a sign that initial 2.x problems were solved.
It seems many users don’t update apps that often (as opposed to me, I always want to have the latest and greatest :P).

power schedule fragmentation

eCPM results with Tapjoy

I’ve had mixed feelings about implementing the Tapjoy “points” system. I can tell you that after a week, so do the users. Some don’t like it at all, and ask me for a paid version insted. I would gladly have one, but as I mentioned countless times before, I can’t sell on Google Play (reason being Google, not me).
Anyhow, I will also add Google Analytics, to analyze some things (such as average events used by each user etc.), to see how users interact with Power Schedule.

But coming back to Tapjoy, the results are promising. I’m getting an average of $7.04 eCPM over the first week since implementation. Also the trend is increasing (since only around 30% of users are using the 2.x version). I hope once people get used to the point system and also the new User Interface, things will get even better.
There are some other things which I plan to keep an eye on: localization. I really want to see the effect of translating Power Schedule to Slovak and French. I hope this will add some completely new users, which didn’t see the original 1.x version at all.

Stay tuned.

development.since.2005