Category Archives: Android

That Was Too easy…

There is an old plot device, which goes back to at least Homer, although the version which popped into my head this evening was Genesis of the Daleks, a 1970s Dr Who story. A group of warriors fight a short but intense battle, and appear to triumph. In Dr Who, the Kaled freedom fighters burst into Davros’s headquarters and think they have dispatched him and his dalek bodyguards. Just as they are starting to celebrate, one of them, typically an old, grizzled soldier who has been round the block a few times, says "Have your instincts abandoned you? That was too easy." True enough, a few seconds later the elaborate trap is sprung, and the tables are turned.

Android 8 is like that. Not that it’s in the service of a malevolent genius, although I’m beginning to wonder, but it lulls you into a false sense of security, and then throws some significant challenges at you.

I got a new phone last week. I have loved my Sony Experia XA Ultra which I have used for the last two years, but been constantly frustrated by the miserly 16GB main memory. The Experia XA1 Ultra is an almost identical device, but with a decent amount of main storage. I had to forgo the cheerfully "bling" lime gold of the XA, replaced by a dusky metallic pink XA1, but otherwise the hardware change was straightforward.

So, initially, was the transfer. Android now has a feature to re-install the same applications as on a previous device, and, where it can, transfer the same settings. This takes a number of hours, but seems to work quite well. I had to manually transfer a few things, but a couple of hours in I worked through the list of applications, and most seemed to be in order with their settings. I could even see the same pending playlist in the music player which, after a lot of trial and error, I installed to randomly play music while I’m on the bus.

The new version of the Android alarm/clock app seems to be complete b****cks, and more trouble than it’s worth, but there’s no barrier to installing the old version which seems to work OK. My preferred app to get Tube Status updates is no longer available to download, but I could reload the old version from a backup. So that was most of the problems in the upgrade dealt with.

My instincts had abandoned me. It was too easy…

I had also forgotten Weinberg’s New Law. ("Nothing new works")

I got to the gym, and tried to play my music, using the standard Sony music player. Some of it was there, but the playlist I wanted wasn’t. I realised the app could no longer see WMA files (Windows Media format), which make up about 95% of my collection. A bit of googling, and it turned out the recommendation was to install PowerAmp, which I did, and it worked fine.

Then I got on the bus, and tried to play some randomised music. Nothing. The app had the files in its playlist, but couldn’t find them. I rapidly confirmed that the problem again was WMA files, which had suddenly become "invisible" to the app. After yet more trial and error installing, the conclusion is that it’s the Android Media Storage service which is at fault. Apps which build their own index (like PowerAmp) are fine. Apps which are built "the proper way" and use the shared index are screwed, because in the latest version of Android this just completely ignores WMA files.

Someone at Google has taken the decision to actively suppress WMA files from those added to the index. This isn’t a question of a problematic codec or similar – they had perfectly good indexing code which worked, and for some reason it has been removed or disabled. I can only think it’s some political battle between Microsoft and Google, but it’s vastly frustrating that users are caught in the crossfire.

I trust Dante reserved some special corner of Hell for those who break what works, for no good reason. If his spectre wants a bit of support designing it, I’ll be glad to help.

And I’ll resist saying "that wasn’t too bad" when I upgrade my technology…

Posted in Android, Thoughts on the World | Leave a comment

An Odd Omission

Let’s start with a common use case…

"I have a television / hi-fi / home cinema system which has several components from different manufacturers. I would like to control all of them with a single remote control. I would like that remote control to be configurable, so that I can decide which functions are prioritised, and so that I can control multiple devices without having to switch "modes". (For example, the primary channel controls should change the TV channel, but at the same time and without changing modes the volume controls should change the amplifier volume.) As not all of my devices are controllable via Wi-Fi, Infrared is the required primary carrier/protocol. The ideal solution would be a remote control with a configurable touch screen, probably about 6" x 3" which would suit one-handed operation."

I can’t believe I’m the first person to articulate such a use case. In fact I know I’m not, for two reasons. When I set up the first iteration of my home cinema system in about 2004, I read a lot of magazines and they said similar things.

And then I managed to buy a dedicated device which actually did this job remarkably well. It was called a Sunwave Universal Remote, and had a programmable LCD touchscreen. It had the ability to choose which device functions appeared where, and to record commands from existing remotes or define macros (sequences of commands). This provided some, limited, "mixed device" capability, although the primary approach was modal (select the target device, and then use controls for that device). A set of batteries lasted about a year.

There were only two problems. First, as successive TVs became smarter than in 2004 it became an increasing challenge to find appropriate buttons for all the functions from within the fixed option list. Then, after 13 or so years of sterling service the LCD started to die. I still own the control, but it’s now effectively unusable.

My first approach was to try and get a direct replacement. However it’s clear that these devices haven’t been manufactured for years. The few similar items on eBay are either later poor copies, with very limited functionality, or high-end solutions based on old PDAs at ridiculous prices.

But hang on. "a configurable touch screen, probably about 6" x 3"". Didn’t I see such a device quite recently? I think someone was using one to make a phone call, or surf the internet, or check Facebook, or play Angry Birds, or some such. In fact we all use smartphones for much of our technology interaction, so why not this use case?

Achtung! Rabbit hole! Dive! Dive! 🙂

Why not, indeed? Actually I knew it was theoretically possible, because my old Samsung 10" tablet which was about to go on eBay had some software called "Peel Remote" installed as standard, and I’d played with controlling hotel TVs with it. I rescued it from the eBay pile and had an experiment. The first discovery was that while there’s a lot of "universal remote" software on Google Play, most is rubbish, either with very limited functionality, or crippled by stupid amounts of highly-invasive advertising. There are a few honourable exceptions, and after a couple of false starts I settled on AnyMote developed by Color Tiger. This has good "lookup" support to get you started, a nice editing function within the app, and decent ways to backup and share remote definitions between devices. A bit of fiddling got me set up with a screen which controlled our system much better than before, and it got us through all our Christmas watching.

However picking up a 10" tablet and turning it on every time you want to pause a video is a bit clumsy, so back to the idea of using a phone…

And here’s the problem. Most phones have no infrared support. While I haven’t done any sort of scientific analysis, I’d guess that 70-80% (by model) just don’t have what’s known as an "infrared blaster", the element which actually emits the infrared signals. Given that this is very simple technology, not much more than an infrared LED in the phone’s top edge, it’s an odd omission. We build devices stuffed with every sort of wireless and radio interface, but omit this common one used by much of our other technology.

Fortunately it’s not universal, and there are some viable options. A bit of googling suggested that the LG G2 does have an IR blaster, and I tracked down one for about £50 on eBay. It turns up, the software installs…, and it just doesn’t work. That’s when I find the next problem: several of the phone manufacturers who make both TVs and phones (LG and Sony are the most obvious offenders) lock down their IR capabilities, so they are not accessible to third party software. You can use your LG phone to control your LG TV, but that’s it, and f*** all use to me.

Back on Google and eBay. The HTC One M7 and M8 do have IR and do seem to support third-party software. The M8 is a bit bigger, probably better for my use case, and there’s one on eBay in nice condition for a good price. It turns up, the software installs…, and then refuses to run properly. It can’t access the IR blaster. Back on Google and confirm the next problem. Most phones which have been upgraded from Android 5 or earlier to Android 6 have a changed software interface to the infrared which doesn’t work for a lot of third-party software. Thanks a billon, Google. 🙁

OK, last roll of the dice. The HTC One M7 still runs Android 5. I find a nice blue one, a bit more money than the M8 ironically, but still within budget. It turns up, the software installs…, and it works! I have to do a few minor adjustments on the settings copied from my tablet, but otherwise straightforward. I had to install some software to make the phone turn on automatically when it’s picked up, and I may still have to do a bit of fiddling to optimise battery life, but for now it’s looking good…

Third time lucky, but it really didn’t have to be that difficult. For reasons which are impossible to fathom, both Google and most phone manufacturers seem to somewhere between ignoring and actively obstructing this valid and common use case. Ironically, given their usual insularity, things are a bit easier in the Apple world, with good support for third party IR blasters which plug into an iPhone’s headphone socket, but that wouldn’t be a good solution given the rest of my tech portfolio. For now I have a solution, but I’m not impressed.

Posted in Android, Thoughts on the World | Leave a comment

Dozy Android

I’ve just spent a good couple of hours sorting out a problem with my new phone, which has no good reason to exist. In fairness to Sony, it’s nothing to do with them: the issue sits squarely with Google and yet another "improvement" to Android which turns out to be nothing of the sort.

A watch-based alarm doesn’t work very well for me – my hearing is just not good enough. Seeking to reduce the amount of gadgets I carry, I have therefore for many years relied on phones and their PDA predecessors to fulfil the function of alarm clock, especially when I’m travelling. It’s not a difficult role, and I have not had to complain about it. Until now.

In my normal weekly cycle I don’t have much need for a clock as I wake naturally at about the right time each day. This makes the operation of such a function even more critical, as it has to be absolutely reliable on days which are exceptions, and I don’t get much opportunity to do much advance "testing" of what I assume is something that should "just work". However, I do have the alarm set every day when I’m working away from the home, and although I couldn’t be absolutely sure I was coming to suspect that it wasn’t going off at the right time. The first couple of times I assumed "user error": incorrect settings, volume too low etc., but I had eventually eliminated those, and confirmed the behaviour: the alarm didn’t go off at the programmed time. It went off after I had woken up and clicked the button to wake up my phone’s screen.

This is about as useful as a chocolate fireguard, and about as welcome as a fart in a spacesuit.

A bit of Googling confirmed that the problem is quite widespread. I’ve read stories of people with new phones being late for work or missing important appointments. Others describe a similar problem with other programs including not getting notified promptly of night-time messages or similar: potentially quite a problem for those "on call". Fortunately I caught the problem before it caused me any trouble, but that might not have been the case, as I have an upcoming trip with about 8 flights and several other dawn starts.

The web is full of useless "solutions" like factory resetting the phone, but after eliminating those, I tracked down the cause of the problem. With Android 6 ("Marshmallow"), Google introduced something called "Doze" mode. This is a deep sleep mode which kicks in if the device is at rest, screen off, and no significant ongoing activity like an active data transfer. You know, like it tends to be at night. In this state, the system not only slows down processing, but also suspends the bulk of normal background activity. This includes, for no articulated good reason, suspending timers and related event triggers. So your alarm application doesn’t know what time it is, and doesn’t fire. Your messaging app doesn’t know when to poll for incoming events. Simple, core functions of your smartphone just cease to work.

Allegedly, if you change the code of your alarm or other app to use a "different kind" of timer, that should work, but after testing four or five I concluded that this is just not true, certainly on my phone. In any case, I usually just use the stock Android "clock" app, and surely they would have remembered to update that, wouldn’t they? You can also nominally turn off Doze for selected applications, but as far as I can see it makes bugger all difference.

It turns out that the root problem is that in at least some Android 6 implementations, Doze mode actually disables the underlying operating system events on which the other timers are based. It doesn’t matter how sexy your alarm app is, or whether Doze knows about it or not, if the underlying timers are blocked!

There’s a heap of advice on the web about how to disable Doze for individual apps (tried that, doesn’t work), but not about how to disable it completely. I’d tried all sorts of settings without success. However I finally found a useful little app called Disable Doze, which does what it says on the tin, and turns Doze off completely. Allegedly (according to Google) this would result in my phone discharging its battery at a terrifying  rate and ending up doing a Galaxy Note 7 impersonation, but I can confirm that with Doze off in light use my phone is still only consuming about 10% battery per day. The only noticeable effect so far is that alarms and notifications work again.

My worry is that until Google acknowledge their mistakes, they may come up with another "improvement" which disables this fix. I don’t know what tests Google perform in this area, but they are clearly inadequate. This really is a "0 out of 10" effort, a true "breaking change".

However for now things are looking good, and hopefully this blog will help alert others to the problem and the fix.

Posted in Android, Thoughts on the World | Leave a comment

Platform Flexibility – It’s Alive!

The last post, written largely back in November and published just before Christmas suggested that camera manufacturers should focus on opening up their products as development platforms, much as has happened with mobile phones. While I can’t yet report on this happening for cameras, I now have direct experience of exactly this approach in another consumer electronics area.

I decided to replace a large picture frame in my office with a electronic display, on which I could see a rolling presentation of my own images. This is not a new idea, but decreasing prices and improving specs brought into my budget the option of a 40"+ 4K TV, which on the experience of our main TV should be an excellent solution.

New Year’s Eve brought a trip to Richer Sounds in Guildford. As usual the staff were very helpful and we quickly narrowed down the options to equivalent models from Panasonic or Sony. The Panasonic option was essentially just a smaller version of our main TV, but the colours were slightly "off" and we preferred the picture quality of the Sony. The Panasonic’s slideshow application is OK, but limited, but the Sony’s built-app looked downright crude. It looked like a difficult choice, but then I realised that the Sony operating system is something called "AndroidTV" with Google Play support, and promised the option of a more open platform, maybe even development myself. Sold!

In practice, it’s exactly as I expected. The basic hardware is good, but the Sony’s default applications beyond the core TV are a bit crude. However a bit of browsing on Google Play revealed a couple of options, and I eventually settled on Kodi, a good open-source media player, which does about 90% of what I want for the slideshow. Getting it running was a bit fiddly, not least because a key picture-handling setting has to be set by uploading a small XML file rather than via the app’s UI, but after only a bit of juggling it’s now running well and doing most of what I want.

Beyond that, I can either develop an add-on for Kodi, or a native application for AndroidTV. However as the existing developer community has provided a 90% solution, I’m not in a great hurry.

I call that a result for platform vs product…

Posted in Agile & Architecture, Android, Code & Development, Photography, Thoughts on the World | Leave a comment

Webkit, KitKat and Deadlocks!

I don’t know what provision Dante Alighieri made, but I’m hoping there’s a special corner of Hell reserved for paedophiles, mass murderers and so-called engineers from big software companies who think there might ever be a justification for breaking backwards compatibility. I suspect that over the past 10-15 years I have wasted more computing effort trying to keep things working which a big company has broken without providing an adequate replacement, than is due to any other single cause.

The latest centre of incompetence seems to be Google. Hot on the heels of my last moan on the same topic, I’ve just wasted some more effort because of a major Google c**k-up in Android 4.4.X, AKA KitKat. My new app, Stash-It!, includes a web browser based on the “Webkit” component widely used for that purpose across the Android, OSX and Linux worlds. On versions of Android up to 4.3, it works. However when I released it out into the wild I started getting complaints from users running KitKat that the browser had either frozen altogether, or was running unusably slowly.

It took a bit of effort to get a test platform running. In the end I went for a VM on my PC running the very useful Androidx86 distribution (as the Google SDK emulator is almost unusable even when it’s working), and after a bit of fiddling reproduced the problem. Sometimes web pages would load, sometimes they would just stop, with no code-level indication why.

After various fruitless attempts to fix the problem, I discovered (Google.com still has some uses) that this is a common problem. In their “wisdom” Google have replaced the browser component in KitKat with one which is a close relative of the Chrome browser, but seem to have done so without adequate testing or attention to compatibility. There are wide reports of deadlocks when applications attempt any logic during the process of loading a web page, with the application just sticking somewhere inside the web view code. That’s what was happening to me.

The fix eventually turned out to be relatively simple: Stash-It feeds back progress on the loading of a web page to the user. I have simply disabled this feedback when the app is running under KitKat, which is a slight reduction in functionality but a reasonable swap for getting the app working… However it’s cost a lot of time and aggro I could well have done without.

Can anyone arrange a plague of frogs and boils for Google, please?

Posted in Agile & Architecture, Android, Code & Development, Thoughts on the World | Leave a comment

My First Android App: Stash-It!

After a couple of months of busy early morning and late night programming, my first Android app has finally been released. Please meet Stash-It!

Stash-It! responds to an odd side-effect of the difference between the iOS and Android security models. On the iPad, there are a large number of applications which offer an “all in one” approach to managing a group of related content. These are a bit frustrating if you want to share files transparently and seamlessly between applications, but there are times when you want to manage a group of files securely, and then the iOS approach is great.

Android is the original way around. The more open file system and component model encourages the use of specialist applications which do one job well, but it can be a challenge to keep related files of different types together, and hide them if you don’t want private client files or the like turning up un-announced in your gallery of family photos!

Stash-It! tries to plug this gap, by providing an “all in one” private file manager, tabbed browser and downloader for Android. You can get all these functions independently in other apps, but Stash-It! is the only one which brings them together in one place. It’s the ideal place to keep content you want safe from prying eyes: financial and banking records, health research, client documents. I suspect a few will even use it for a porn stash, but that’s not its only use! 🙂

There are built in viewers for most common image and movie formats, plus PDF and web files, so you don’t have to move these outside the application to view them. However when you do need to use an external application Stash-It! has a full suite of import and export functions to move your files or open them with other applications.

It took a while to design the security model. Stash-It! encrypts the names of files so that they can’t be read, and won’t be visible to the tablet’s gallery and similar applications, but the content of your files is untouched, so there’s little risk of losing data. Hopefully this strikes a sensible balance between privacy and risk.

Even if you’re not too worried about privacy Stash-It! is a great place to collect material related to as particular project, with all your different file types and web research in one place. You can bookmark web links, but also positions in video files or PDF documents. Web pages can be saved intact for reference or offline reading. Again you can do a lot of these things in separate apps, but I believe Stash-It! is the first one to bring all these functions together where you might want them.

I’ve got a lot of ideas in the pipeline to improve it further, but its now time to test the market and see whether I’ve spotted a gap which needed plugging or not.

Take a look and let me know what you think!

 

Here’s the Google Play Page. You can also read the helpfile.

Posted in Agile & Architecture, Android, Apps, Code & Development, My Publications, Thoughts on the World | Leave a comment

Developing for Android

Regular readers will realise that I’ve been rather quiet recently. The reason is that over the last couple of weeks I’ve bitten the bullet and started seriously developing an “app” for Android. As always when I have a programming project in progress other uses of my “project” time tend to take very much a back seat, so apologies if you’ve been watching for photos or words of wisdom… 🙂

I don’t want to say too much about the application itself until I have something ready to put on the market place. Suffice to say I think I’ve spotted an odd gap in the market where the weaknesses of iOS force a number of good solutions to one problem of information management, whereas Android’s more flexible architecture ironically mean the problem goes unsolved. Watch this space.

I was initially a bit worried that the learning curve for Android development might be very steep, especially when I started working through the standard Java-based examples in the official Google development toolkit. Like all Java development that approach seems to require a vast amount of “scaffolding” code, which must be constructed with very little environmental help, to achieve very simple results. This didn’t look good.

Then, thankfully, I discovered Basic4android. This is a remarkable toolkit developed by a small group in Israel which allows the development of Android software using a powerful but very accessible language and IDE based on Visual Basic. Behind the scenes, this is compiled into standard Android Java code, so ongoing delivery of applications is standard, but the coding and design process is close to “pure VB”.

The development environment has all the features you could reasonably ask for, including code completion, syntax highlighting, background compilation and the like. Remote debugging extends to devices connected over the Internet as well as via cable or local networks, and has a cunning feature where you can “hot swap” the code behind a running application allowing a range of changes to a running test application without restarting it. These are very impressive abilities for a product from a relatively small company.

Just as with the original VB, Basic4android has a model which allows developers to supplement the platform capabilities with shareable components, libraries and code snippets, and a very active community has rapidly built a library of “donationware” which provides easy access to the majority of Android features. I’ve had to be a bit ingenious in a few cases, but even as a newbie on my first project I haven’t yet found a requirement which can’t be met with a few lines of code.

On a slightly more negative note, Basic4android doesn’t seem to provide a good solution to the problem of supporting multiple screen sizes and orientations, except by writing multiple hard-coded scripts for the various options. This problem has been solved for websites with the concept of the “responsive grid”, and it ought to be possible to arrange the UI of an Android app with similar logic (e.g. “arrange these two controls side by side with the label taking 75% of the width, unless the screen is narrower than X, in which case arrange them vertically”). If this can be done in Basic4android I haven’t yet worked out how.

Debugging on a physical device connected directly to the PC is very straightforward, but of course limited to the devices you own, and a bit clumsy if you fancy doing a spot of work when travelling. While the Android development kit includes an emulator for the PC, it runs so slowly as to be completely unusable, even on a high-spec machine like my AlienWare M17x. I may have discovered a better compromise, in Android-x86, a port of Android which runs happily in a VMWare virtual machine. Installation was easy, but there are a few foibles I haven’t yet conquered. Again, watch this space.

Overall my adventure into Android development is shaping up well. More news later.

Posted in Android, Code & Development, Galaxy Note, VMWare | Leave a comment