Categoryandroid

Easy Movie Texture For Android Version: 2.18

Whoever uses the Easy Movie Texture For Android (Video Texture) version 2.18 and also uses split apks (obbs) in unity might run into problems with the streaming asset sub-folders. It’s a great plugin to handle rendered textures on mobile devices.

However the plugin fails to create sub-directories while copying videos out of the obbs into their respective sub-folders. Which can fixed by adding

in the MediaPlayerCtrl.CopyStreamingAssetVideoAndLoad.

So it looks like this:

Also in order to have a e.g. complete callback, simply add a

in the same class and call them at the respective m_CurrentState checks:

I’ve already e-mailed the fix to Lee JaeYun and it will be fixed in a later version presumably, until then use the fix and enjoy.

Android Re-Signing Apks

In case you want to re-sign your apk with a different keystore one day you might be delighted to hear that there is a convenient shell script for this already.

It basically removes the java manifest meta file, then runs zip align and the apk signing tool of the android sdk. It naturally requires the apk, the keystore with its alias and password.

Here is the script:

In order to run it, add execution permission in the terminal:

Then simply run the script by adding the parameters.

Have fun.

iOS vs Android in Numbers Q2 2014

I often get caught up in discussions about iOS and Android. And what platform one should target as a developer. So let’s compare some numbers, shall we?

Android owns 84.7% of the global smartphone market share where iOS is at 11.7% according to International Data Corporation.

This was also nicely put by the article Android iOS Development Monetization Marketing: “The facts are pretty staggering. While all of us iOS app marketers have our heads buried in the latest App Store algorithm changes and churn and burn models, the rest of the world was buying Android phones.”

Also according to netmarketshare.com stating in the article Android overtakes iOS in usage stats for the first time ever: “The latest data from Net Applications show that smartphones and tablets powered by Android were used more than iPhones, iPads, and iPod touches powered by iOS this July. While iOS usage dipped from 45.61% in June to 44.19%, Android’s increased from 43.75% to 44.62%.”

Therefore one might conclude that a global market share difference of 73% and more app usage will equal more money on Android. However it’s a bit more complicated than that as this article claims: “Real differentiators between iOS and Android are their users”.

Where iOS not only dominates in the US and Europe but

the user spending power is quite different as well. Interestingly Business Insider stated this on on multiple occasions here, here and here.

Also the fragmentation of android devices is just ridiculous and the iOS adoption rate is by far superior.

So what does it all mean?

At the end Google Play downloads exceeded iOS App Store downloads by around 60 percent this quarter, while the iOS App Store earned about 80 percent more revenue according to App Annie Intelligence estimates. More can be read here.

As always – it depends as stated in the article Android Monetization Myths: “Actually, numbers imply that Android apps can be just as profitable when monetization is done properly and with respect to specific rules that guide customers’ behaviour on the platform. For example, direct sales and in-app purchases are clearly Apple territory at this time, but Android offers much more in terms of potential for ad-driven revenue. […] Don’t get discouraged by the urban legends about Android monetization and get reliable data before you start planning how to make money on your app.”

It’s healthy to test for yourself here are some lessons from Chris Pruett’s GDC Talk 2013 (Robot Invader) – Fact and Fiction: Lessons from Wind-up Knight and Rise of the Blobs

What do you think? Please leave comments below.

Android How to programmatically close an app by pressing back button properly.

Everyone who uses apps knows that they are sometimes rather tough to exit. It’s not always because developers don’t care too much about it. Sometimes the api is tricky. If you want the user to exit your application by pressing the back button you need to override the onKeyDown method in your activity. The default implementation would be moveTaskToBack(true), which basically pauses your app and sends it to the background, right? Wrong! Because it only pauses the ui-thread.

Which means any other asynchronous task running keeps running. It wastes resources, leading to a worse user experience and and eventually to uninstalls. Why? Because it’s a unexpected behaviour. I mean don’t get me wrong, it’s perfectly fine if the app goes to the background because the user is getting interrupted by other apps. However if he wants to exit, he should have a possibility to do so. But what then?

Calling finish() often doesn’t do the trick. In that case you can use killProcess with the app process id.

Done. Just make sure that you have finished all your business before actually killing your app like saving preferences, etc. It will immediatelly close the app.

See also activitys-threads-memory-leaks

How To Get Android OpenGL 1.0 and 2.0 Information and Constrains – Revisited

Some time ago I’ve made a short post (here) about the basics of how to get opengl infos on an android device. For an app I’m currently working on it was required to get all interesting information once more in my android device information application. The basic idea is to add a respective opengl 1.1 or opengl 2.0 and possibly even opengl 3.0+ context to the active view, load all information in the onSurfaceCreate method of the renderer and remove the view afterwards again.

You’d use it appropriatelly like that in your activity:

Here is what I came up with:

Enjoy. (:

Soundlooper

Soooo Albért and Marco were visiting me the past week. They needed a couch to crash in Berlin to watch the football world championship. Congrats to Germany by the way for winning the champion ship! Anyways, Marco works as a DJ and he was playing around with his laptop to generate some random sounds. That got me inspired to create a little app over night. It basically loops through a matrix of matrices of tones and plays them that’s why the name Soundlooper. Pure creativity I know, right? xD


Continuous Integration with Maven and Travis for Android

In order to run your android unit tests automatically on external virtual server after each git commit you need a continuous integration system. There are a couple of good services e.g. jenkins and travis out there. But how do you use them? Here is one way for travis. You can start off by forking android-maven-example and adapt it to your own project. Maven’s package manager ability let’s you download and install all dependency packages. In example you also have several maven goals pre-defined. Most important ones are install – installing to a device or emulator, package – creating a jar of your libs and clean.

Now the automated tests are setup and you only need to make an account on https://travis-ci.org/ and turn on all the repositories which you want to let test.

The android maven example travis file is a bit outdated however. Android has been added as a first class citizen. So your travis.yml file could look like this:

To run the maven tests locally you can also create an emulator and run the maven goal. Note: On MAC you can also install travis-build to simply run everything by using travis run.

Create the emulator named test with e.g. API 10 and armeabi cpu.

Start the emulator. Note: No window required for first tests, if you want to tests the ui you might want to remove the -no-window parameter.

Run the test goal. Note: -e -X for showing errors and warnings in the console.

See also Travis CI for iOS.

Andorid: Free internal storage.

For everyone who also ran into internal storage shortages on android devices, clear up /data/log, /data/lost+found/ and /data/local/tmp – in my case it consumed 1.7GB out of my 2GB memory. (requires a rooted device)

Android: OpenGL 1.0 and 2.0 infos

So here I was again, trying to figure out a way to get opengl infos like max texture size, max uniform vectors, max vertex attributes, etc. for several android devices. Technically you could just use a small getter:

The problem was that on many devices the the returned number would always be 0. That’s because there hasn’t been created an opengl context yet. As suggested on Stackoverflow you could create a GLSurfaceView, add a renderer which could read the required infos by adding the glsurfaceview to the actual main active view and simply remove itself when done. In order to get opengles 1.0 and opengles 2.0 infos you would need to create two surfacesviews with different opengl versions. The following example looks a bit complicated, because I use fragments which i need to update on the main thread after I got all the infos I wanted. A full example is on github.

Dynamicly updating local ip address of Node.js server with Node.js

Hey folks,

I’ve been developing on multiplayer game called Drag’n Slay on at least 4 different locations and it’s been a pain in the ass to change the ip address on the backend-server web and unity android client and unity editor client everytime manually so they will connect to the socket.io (tcp) and diagram (udp) server.

So had an idea. What if I could let the clients connect to my already payed webserver and get the fixed but changing ip.
I figured it would require a couple of steps to do so:

1) load ftp credentials from a git-ignored file
2) figuring out the lan and wan ip address
3) creating a php script that respond a json object with the accessable ip addresses to the server
4) uploading the php script to my always accessable webserver
5) loading the json file on the clients and connect to the server by using the dynamic ip address

1) [node] reading credentials

the credentials.txt:

2. [node] getting the ip address is quite easy with os.networkInterfaces()

3. [node] dynamically creating the script that will respond the ip addresses respectively Important: In order to allow cross domain loading of the json object set Access-Control-Allow-Origin: *

I also made a short link to my node.js webserver default website:

4. [node] uploading the ip address to the server by using jsftp

5. [web-client] and finally using jquery connect to node.js socket.io with the dynamic ip

[android client] one way to receive the url on your android client is by using an async task; grab the ip whenever you need it (e.g. in your onCreate-activity method)

convinient call back method:

and you you’ll need a json parser