Tag Archives: android

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


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

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"
		return installedPackages;

I hope this helps.

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

Unlimited Power Schedule version on Amazon Appstore

I have some new updates which I didn’t post online yet. First of all, the new 2.1+ versions got Power Schedule users back. Yes, the 2.0 version was quite a disaster, as it was quite complicated to use. Also the point system was not sufficiently explained. Here’s the chart from Google Play:

Anyhow, I’m glad things are getting back on track.
Also, the new 2.1.2 version is translated to Slovak, French and Romanian (more languages to come). By the way, if you know Japanese, Italian or Spanish and want to help me out with the translation, drop me a message.
Today I just uploaded the “point free” Power Schedule version to Amazon Appstore and SlideME alternative Android markets. Yes, it seems they are more open to developers, as they allow me to sell apps there. Power Schedule “unlimited events” edition costs just 0.99$. If you don’t like the point system, you can get the paid version. No ads, no points – just events. As many as you like 🙂

It will take a few days until the Amazon and SlideME staff review and approve the app (hopefully :)). I will post the purchasing links then.

Also, stay tuned for an income report update. This time, from AdMob, Leadbolt and Tapjoy.

Ad report – last 25 days.

As I said before, I will publish the revenue generated by ads. In total, Power Schedule and App List generated a total of… 6.16$. 🙂
This is not much, as the ads are non-obtrusive and are displayed only if the user requests it (by choosing the “Special Offers” menu item).
Here’s the screenshot from my LeadBolt account (referral link):

15 March - 10 April LeadBolt Ads income

During the last week, I’ve been walking continuously n my Sisyphus path (also known as Power Schedule 2). I managed to rethink most of the User Interface. Hopefully it’s much more friendly and intuitive – also a LOT more flexible 🙂
Yes, most of the requested features are present (and working) already. I’ll leave the rest for the future versions (better to have a stable running version before adding new stuff). This will also support localization properly, so you’ll have Power Schedule in your own language (I’ll post the files soon for translation).
I *may* be able to release it this week (we have Easter holiday on Sunday, maybe things are more relaxed at work).

Meanwhile I also made a small fix for the 1.x version of Power Schedule – mainly, to support Data Connection control on Gingerbread (2.3+) devices. Grab the 1.6 version from the market now if you haven’t already.

So, next post will hopefully be the release news 🙂

App List

So I just released a new app – it’s called simple: App List.

You can check it out now here (Browser link):
App List on Google Play

or here (Android link):
App List on Play Store for Android

You can use it to quickly share some apps you like with your friends (via Facebook, Twitter, Google+, Gmail or whatever sharing app you have installed on your Android device). Also, you can filter/search your installed apps list, view details about each one, open them or open the corresponding Google Play Store page (if any).

I implemented this one to familiarize myself with other Android topics. I’ll post a tutorial about what I’ve found out soon.