Sunday, 18 December 2011

Logical Slimmer Llamas

The new beta version of Llama now supports ORs of conditions. Normally, an event will only fire if all of its conditions are true, but there are some times when you'd want only some of those conditions to cause the event to fire. Previously, you could solve this by having multiple similar events, but that quickly gets messy (especially with Llama's crappy UI ;). The OR operator is implemented in Llama as a special condition that takes a list of other conditions and only requires one of them to cause the event to fire. At the same time, I've also added an AND condition. You probably won't use this much, as the default behaviour of an event is an AND, but if you need to use an AND inside an OR this is how you achieve it. Most people aren't familiar with ORs and ANDs (at least in the Boolean sense), so Llama also refers to them as 'match all' and 'match any' respectively. You can read through the previous paragraph and replace 'OR' with 'match any' if you like.

To create an event that vibrates whenever you plug in the headset or charger, you would need to create an event like this:

OR (Match any) (Headset connected, charging) -> Vibrate

If you have event colouring enabled in Llama's settings, you'll also be able to see the current status of the ORs and ANDs. Each OR and AND will have a set of square or curly brackets that show which conditions it contains, and also the state of those conditions. If any of an OR's conditions are true, then the brackets will be green, otherwise they'll be red. Similarly, if all of and AND's conditions are true, it's curly brackets will be green, otherwise red.

Another noticeable change is the naming of builds. Android lets apps have two version numbers:

  • a version code (usually just incremented from 1)
  • a version name (whatever you want, I use the compile date)

Previously, I used the version code to name the beta builds that I upload to mediafire. Since I introduced in-app billing I now need to keep the version code in-sync with the version on the market. The market uses the version code to determine whether a version of an app supports billing or not, otherwise it'll say:

'Application Error: This version of the application is not configured for Market Billing. Check the help center for more information.'

From now on, the version code won't increment until I plan to release a market version, so that the betas can still use in-app billing. Finally, I've got around to using ANT builds rather than hitting the Export signed APK button in eclipse. Llama is also getting fat and overweight with all of the languages that it has, so I've set up a tool that'll build 4 versions of Llama:

  • The usual market-style Llama you all know and love, with all the languages and no CALL_PHONE permission.
  • A version with all languages and CALL_PHONE permission, so that you can dial call-forwarding codes.
  • A thinner version of Llama with only en-gb resources, and no CALL_PHONE.
  • A thinner version of Llama with only en-gb resources, and CALL_PHONE permission.

You can find these versions in the Kebabapps Llama page on mediafire. I won't always remember to link to them.

Assuming all goes well, this version will be released to the market next week, maybe in time for Christmas, or maybe after if I'm not doing anything exciting for Boxing Day. You can also assume that me reading reddit will play some part in delaying the release :)

Version 1.2011.12.18.2207

  • OR/AND - Match any/all conditions
  • An alternative colour-blind setting for the coloured event list
  • Event list now colours events on a separate thread, so switching tabs responds faster
  • Events run through shortcuts now appear in event history
  • Fixed a forgetful Llama problem when using LlamaMap in low-memory situations
  • Now uses big red button for doing builds

[Insert the usual disclaimer about exporting Llama's data before installing test versions]

Download

Sunday, 4 December 2011

As promised, here's a version of Llama that briefly moans at you for using MIUI ;) It'll pop up a notification when you change profiles, which you can then set to never appear again. I've also set the Llama Variable condition and action text boxes as auto-complete text boxes, so that you can use the variable names and values from your other actions and conditions.

Version 1.2011.12.04.1425

  • Framework for showing messages which can be marked as 'never show again'.
  • MIUI specific message when changing profile, which warns about permissions changes in MIUI.
  • Llama variable auto-complete text boxes

As usual, export your data before installing test versions, just in case you have to go back to the market version.

Download

MIUI annoyance

I've just installed MIUI to tackle a bug with Llama not being able to set call volume. When Llama changes the volume, this message appears in the LogCat:

Phone Related Audio Settings Permission Denial: setStreamVolume() from pid=2266, uid=10041

This is related to a feature in MIUI which seems to automatically deny applications the call-related permissions, unless you opt-in to them (which I think is a good idea, but the implementation is not perfect). You need to do these steps to enable the permission:

  • Go to the super-user app
  • Go to Llama's app details
  • Set the misleadingly named 'monitor calls' to allow. Llama can now adjust the volume

What MIUI should be doing is notifying you that a permission was denied and offering you a way to fix it. That why you can see why an app is misbehaving. Instead, this just looks like Llama doesn't work properly, which is not very helpful for me (I get emails) and you (you have to email me).

MIUI should also split out the potentially privacy invading 'monitor your calls' permission from the more harmless 'change the volume of your ringer' permission.

I'll be adding a MIUI-specific bodge to Llama that will popup a message informing you how to fix it. Sadface .

</rant>

Saturday, 3 December 2011

App start/stop condition and donations

Following on from the event-testing speed up two blog posts ago, Llama can now monitor the currently active application. You can now do interesting stuff like turning Wifi on when you open the browser, or adjusting the volume when you open a music app. Every time that you switch app, Llama will need to check if your events should fire. That's why the performance improvement was needed first, and why I've been putting it off until now :)

If you don't include an Active application condition, Llama won't waste time checking the active app. However, if you do use it, Llama will need to poll the ActivityManager for the current application. It's a shame that Android doesn't let an app receive a prod when the app changes. You can change the polling time in Llama's settings; the smaller the value, the quicker Llama will be able to respond, but it'll take more CPU time. If you set it to a high value, say 1 second, you should be fine. One second is probably good enough for most people, given that the start application animation takes about a second.

I've also implemented in-app purchases for donations. Plenty of people have wanted to donate more than 80p, so you are no longer limited to the one-off 80p Llama Donation that's in the Market. If you donate from within the app, you can finally uninstall the Llama - Donation app if you wish. The in-app purchases act as a separate marker that Llama checks to see if you've donated. (Not that there's much of a difference after donating... you just won't see the donate message ever again.)

You can donate as many times as you want, so you can add up the donations to your target value.

I've only tested this on my English, Great-Britain based phone, which shows the currency and prices in GBP. I'd be interested to hear if any you have problems looking at the donations page using a phone from a different country. Ideally, it'll show your country's currency if the Market supports it, otherwise fall-back to GBP.

Version 1.2011.12.03.2130

  • Active application start and stop condition
  • In-app donations
  • App notification icon condition now has an app-picker
  • Updated Polish and Slovenian translations, cheers guys :)

As usual, export your data before installing test versions, just in case you have to go back to the market version.

Download

Tuesday, 29 November 2011

A bugfix for the previous post

Here's a fixed APK of the previous version. Delayed and repeating events will now behave correctly. Since Llama now only check events that are likely to be affected by a trigger, you may find your delayed or repeating events lingering about for a bit longer. They'll only be checked when their 'delayed until' or 'repeating at' time expires. They still won't run their actions if they shouldn't, but since Llama isn't constantly/needlessly checking them Llama can't remove them earlier.

It also now has the market's BILLING permission included so I can start working on an alternative way to donate. A lot of you want to donate more than 80p, which is very cool :) There's no UI for the donation at the moment, so it's just sitting there in the code not doing anything for now. If you're worried that I might try and ninja-bill you, then rest assured that you have to confirm an in-app purchases through the Android Market. It would be pretty dumb otherwise.

Version 1.2011.11.29.1700

Download

Sunday, 27 November 2011

100,000 Llamas

The Android developer console says Llama has been downloaded 100,000 times now, and because it's a nice round number caused by the fact we have 10 digits on our hands we should celebrate! Although I'm not quite sure how to celebrate yet.

In the meantime, there's a bunch of new features to play with.

Version 1.2011.11.27.1700:

  • Audio becoming noisy condition, which may react faster than headset unplug or Bluetooth device disconnected on some phones.
  • Desk dock condition
  • Shutdown phone action.
  • Locale action plugin support
  • Speak action (requires Android Text-To-Speed engine.)
  • Calendar events can now filter by all day and busy/available.
  • Updates Minimalistic text widget when the phone boots, so that it isn't blank.
  • WiMax toggle should now work on more phones.
  • Llama no longer updates the vibrate mode if it hasn't actually changed (to prevent some superfluous vibrates on Samsung phones.)
  • Fixed calendar reading in Ice Cream Sandwich.
  • Speedier event tracking... Llama now only checks those events that are likely to be triggered when testing events, rather than checking all of them. However, this only makes about 200-300ms difference.

As usual, export your data before installing test versions, just in case you have to revert to the market version!

Download Llama - FYI - I've found a bug. Repeating or delayed events may not fire. If you use those, don't install it yet. Expect a fix later today.

Wednesday, 23 November 2011

A quick note about ICS and calendars

There's a problem with phones running Ice Cream Sandwich and the Market version of Llama, which is caused by Llama trying to access calendar events. This is because the Calendar API in Android was never officially released, so had to be implemented using unofficial API calls. Now in Ice Cream Sandwich Google have finalised a way of reading calendar events. Unfortunately, it's subtley different to how Android 2.3 worked, so Llama craps itself.

There's a test version that ignores the problem rather than crashing on the blog, but Calendar events aren't working just yet. I'm working on it :)

http://www.mediafire.com/download.php?zyclotff7kdboy7

As usual, backup your data before installing the test version, just in case you have to uninstall and go back to the market version.

As an annoying note... Android give developers an emulator to test this kind of stuff. However, they don't let the emulator log into a Google Account, so you can't access a calendar! D'oh! If you'd like to lend a hand, get in touch by pressing the Llama-question-mark button in the app and emailing me. Ta!