Category Archives: Rant

The Android battery problem

Android Battery Drain

Whoever owns an Android device might wonder why it is that, most of the time, the device barrely makes it through the day, even with moderate usage.

After many experiments, I finally found the culprit: Google Play Services and its location feature.

Battery settings

There are 3 settings in the location mode. Let’s go over them:

Device onlythis setting is the most simple one (as long as the definition of simplicity does not take into account the math needed to derive a position from satellite beacons). It is the same system that a standalone GPS will use. Lock on to several satellites, download their ephemeris data and compute the position from that. The advantage is that there’s no network needed, just a clear view of the satellites. The disadvantages is that it can take 10-30 seconds and it doesn’t work so well indoors.

Battery saving: this mode will scan for a list of current WiFi accesspoints and the phone tower the phone is connected to then compare them with a (possibly cached) database from Google. Since Google knows the position from the data, it can give back a position. The advantage of this mode is that it’s very fast. The disadvantage is that it requires network coverage and communication with Google if the data is not cached.

High accuracy: this mode combines both previous modes. It scans for WiFi and phone towers, gets the data from Google but then, it uses the GPS to confirm that data, or, if Google had no match for it, it creates that new data for Google.

Wardriving for the masses

What happens when using High accuracy mode is akin to wardriving around with a laptop and a GPS and submitting the data to a central server (Google). This uses a lot of battery. Not only is the GPS often used but there’s plenty of network communication with Google and WiFi scanning. The device is also often woken up to perform a fix.

So which is the mode which uses the least battery power? It’s Device only. Just try it for a few days and you’ll see. The battery saving mode’s name is just plain bad naming. It will still perform scanning, communication with Google, and it won’t be very accurate in case there’s no access point around.

My Nexus 5 switched from not even a day of battery (high accuracy) to 3 days (device only).

Using the proper data type

How to represent datatypes? For example in a JSON output.

Dates

Don’t do things like:

2014-01-17T18:01:30+01:00

Seriously. Do you have any idea how difficult and computationally intensive this is to parse? And I’m not even talking about the variants with timezones like GMT, PST, Z, +- offsets and so on.

Instead, do the following:

1389978090000

This is the number of milliseconds since the beginning of times, that is 1st January 1970 with an UTC time zone. It’s easy to parse and there’s no room for interpretation. Every library understands that format.

Durations

Don’t do

3111.44

This uses floats. Not only it can give rounding errors but it’s slower than integers. Instead do:

3111044

which is the number of milliseconds. Again easy to parse and every timer related library understands integer milliseconds, not necessarily floats.

Keep it simple and efficient.

X-Arcade. The not-so-joy stick

Why the X-Arcade sucks donkey balls


xarcade_solo_1

So there is the X-Arcade. A “high end” joystick which is supposed to bring arcade quality control to most computers or consoles. The stick is great, the buttons are fine, the construction is robust and well done, but the electronic sucks beyond anything imaginable. Here’s the problems one can have with an X-Arcade:

PS/2 connection not working with all motherboards

Actually it’s quite difficult to find a motherboard which allows both the X-Arcade and the keyboard to work in PS/2 mode. Usually you get the following: the X-Arcade works but the keyboard (which passes through the X-Arcade) either hangs frequently or dumps duplicate characters rendering it completely unusable. The answer to that problem would be to use an USB adapter for the X-Arcade, but let’s see the next point.

The USB adapter manufactured by X-Gaming doesn’t work

That’s true. Actually it almost works but every now and then the direction stops responding for 1 second. I won’t mention how great this is when playing a game and you lose a life because your ship got stuck during a crucial moment. After a few mail exchanges with X-Gaming, they sort of acknowledge that problem and suggest buying an “Y-mouse” (some PS/2 -> USB adapter manufactured by someone else) which acording to them is “the only PS/2 to USB adapter working with the X-Arcade”. Then why the hell do they manufacture and sell their own one? To waste people’s time and money? Seems so.

Generic USB adapters have troubles working as well

It seems their statement about the “Y-mouse” is true (I don’t have one to test though). Because most random PS/2 to USB adapters which do work fine with PS/2 keyboards fail to work with the X-Arcade. Update: it seems it works better if there’s a keyboard plugged into the X-Arcade (which is really annoying). A friend of mine found a working adapter and mailed one to me (thanks!). It’s a ‘Maxxtro’ adapter.

The X-Arcade prevents the memory card to be used with a PlayStation

Plug an X-Arcade to a PlayStation and you can only access half of the memory card. I really don’t know how they managed to produce that wonderful side effect but it effectively renders the joystick unusable with a PlayStation.

The X-Arcade doesn’t work with all PlayStation 2 models

That’s in their FAQ on their homepage. I’m lucky enough and it works with my PlayStation2! Wohoo! I found a usage for that joystick!

In any case I’ll never buy a product from X-Gaming again.


On 2006-07-11 I received a mail from Shawn Walters who apparently is the owner/founder of X-Gaming. Here’s his view on the subject:

I’d like to respond to the comments posted about my company’s products on your site.

The issues you raise are EXCEPTIONS, not the rule. Our PS/2 connection works with 99% of motherboards produced, although it’s impossible to ensure compatibility with 100% of the chipset manufactures due to specific amount of power needed for our multi-mode programming functionality and input speed.

However, All X-Arcade units shipping after August 1st include a standard USB connection out of the box, eliminating your complaints about PS2/keyboard connectivity. Customers can now connect their USB or PS/2 keyboard directly to computer.

I’d kindly request you correct or remove your aggressive comments; I’m not sure what end you believe they achieve as we’ve had reviews of these products in nearly every single gaming publication in the US and Western Europe–although your bio says you don’t like to talk about negative, that seems to be only thing you are focusing on.

Regards,

Shawn

Good to see that they corrected the problem.