code.neenbedankt.com http://code.neenbedankt.com Most recent posts at code.neenbedankt.com posterous.com Sun, 30 Oct 2011 00:46:00 -0700 Be aware of ProGuard optimizations on Android apps http://code.neenbedankt.com/be-aware-of-proguard-optimizations-on-android http://code.neenbedankt.com/be-aware-of-proguard-optimizations-on-android

Yesterday I released Rainy Days to celebrate passing the 400k downloads. Soon after, my celebration was partycrashed when a few users reported that Rainy Days wouldn't open on their phone. First I was clueless, especially because I either couldn't reach those users or couldn't get a logcat from them showing me the error. The only thing I had to debug was their Android OS version and screen size basically. So I fired up some emulators and tested various configuration again, this is something I do before every release in fact. I couldn't reproduce the bug.

Then I got one other email. Again, a user on 1.5 which couldn't launch the app. So this time I took the released apk, put it on the emulator, and sure enough: it crashed on open. Actually it crashed with a verify error, meaning that a class is referencing methods that don't exist on that platform.

When it runs fine from Eclipse on 1.5, but the released version doesn't it, what is the difference? The released version was run through Proguard to obfuscate the code. But Proguard does not only obfuscate, but also optimize your code and it does a pretty good job at it.

Unfortunately it had this time inlined the class I use for compatiblity code which caused the verify error. The code I took great care to separate out to make sure it wouldn't be called on older platforms was now inlined in my main activity. Auch.

So the lessons learned are these: be aware of optimization and test the release apk on the emulator. Proguard is a powerful tool and with great power comes great responsibility :)

Permalink | Leave a comment  »

]]>
http://files.posterous.com/user_profile_pics/401452/image.jpg http://posterous.com/users/36UQBMgVchtD Hugo Hugo Hugo
Sat, 29 Oct 2011 03:09:00 -0700 Rainy Days 2.2.3 http://code.neenbedankt.com/rainy-days-223 http://code.neenbedankt.com/rainy-days-223

Rainy Days just passed the 400.000 downloads mark, amazing! To celebrate, here's a little update that improves performance and fixes some bugs.

New in this version is that you can move the map when the animation is paused. To do that use two fingers to pan the map. Because this uses multitouch it will not work on all phones and may not work that well on some other phones which have limited multitouch support.

If you already have the app installed, the market should notify you soon of an update. If you don't have Rainy Days, check it out in the market!

Edit: 2.2.3 unfortunately broke 1.5 & 1.6 support, which is fixed now in 2.2.4.

Permalink | Leave a comment  »

]]>
http://files.posterous.com/user_profile_pics/401452/image.jpg http://posterous.com/users/36UQBMgVchtD Hugo Hugo Hugo
Wed, 27 Jul 2011 02:07:00 -0700 Android Logging http://code.neenbedankt.com/android-logging-utility http://code.neenbedankt.com/android-logging-utility

Logging in any type of software is a useful tool to debug and improve your software. Typically you'll have different types of stuff you want to log: errors, information, traceing etc. So most logging systems have a concept of levels that allow you to specify how important a message is, so that at a later time you can enable a certain type of logging to inspect.

In Android it is handled by the Log class. It too allows for runtime configuration of loggers and it involves setting Android system properties using the setprop command, which is nice if you are building an app as part of the OS but maybe overkill or even clunky if you just want to create your next great app. And what if you don't want your shipping app to have any logging whatsoever? You certainly want it during development, trust me :) Well enter this little utility class:

package com.neenbedankt.rainydays.util; public class Logging {     public static final boolean LOGV = true;     public static final boolean LOGD = false || LOGV;     public static final boolean LOGI = false || LOGD;     public static final boolean LOGW = false || LOGI;     public static final boolean LOGE = false || LOGW; }  
What this does is setting some flags that indicate what level of logging you want. If you want all logging, just set LOGV to true. If you only want the "info" level and up just enable info. Easy! Now you still have to reference this from your code like this:

// you can also use a static import to drop the Logging part... if (Logging.LOGD) {  Log.d(TAG, 'This is my debug statement'); }
Tip: you can setup an Eclipse template to generate these kinds of code blocks very fast.

Now the beauty of this all is that since the LOGD variable is a static final (a constant) the compiler will strip out the entire if statement if the LOGD variable is false, hence no logging in your final app and no bytecode generated for it either.

So by introducing a simple class and wrapping the log statements in an if block you'll still be able to enable particular levels of logging, while in your shipping product the logging is stripped out.

Permalink | Leave a comment  »

]]>
http://files.posterous.com/user_profile_pics/401452/image.jpg http://posterous.com/users/36UQBMgVchtD Hugo Hugo Hugo
Wed, 13 Jul 2011 23:25:00 -0700 Outage http://code.neenbedankt.com/outage http://code.neenbedankt.com/outage

This night (in my timezone) something went seriously wrong with the server that I use for Rainy Days. The result was that "network error" was displayed. I've fixed this now and all should be returning to normal within a couple of hours.

If you still are experiencing network errors after that, please let me know.

Permalink | Leave a comment  »

]]>
http://files.posterous.com/user_profile_pics/401452/image.jpg http://posterous.com/users/36UQBMgVchtD Hugo Hugo Hugo
Tue, 12 Jul 2011 12:52:00 -0700 Rainy Days 2.2.1 http://code.neenbedankt.com/rainy-days-221 http://code.neenbedankt.com/rainy-days-221

I just pushed out Rainy Days 2.2.1 that fixes some important bugs. On slow connections Rainy Days would sometimes crash or hang. I've now fixed this so get the new version!

Permalink | Leave a comment  »

]]>
http://files.posterous.com/user_profile_pics/401452/image.jpg http://posterous.com/users/36UQBMgVchtD Hugo Hugo Hugo
Sat, 02 Jul 2011 03:35:00 -0700 More updates http://code.neenbedankt.com/more-updates http://code.neenbedankt.com/more-updates

I've just released Rainy Days 2.2, a small update to fix some crashes that are reported. Also not all of you liked the on-screen legenda, so it can now be switched off from the settings.

I also like to thank all of you who support Rainy Days by buying the upgrade or just telling me how much you like the app! Really amazing!

Hugo

Permalink | Leave a comment  »

]]>
http://files.posterous.com/user_profile_pics/401452/image.jpg http://posterous.com/users/36UQBMgVchtD Hugo Hugo Hugo
Thu, 30 Jun 2011 12:00:00 -0700 Rainy Days 2.1 http://code.neenbedankt.com/rainy-days-21 http://code.neenbedankt.com/rainy-days-21

Here it is, a new update to Rainy Days, still going strong :) In 2.1 I've added a couple of features:

  • On screen legenda, ranging from light to heavy precipitation (yes, finally!)
  • You can now search for a location, using the search key or the search option from the menu. This also allows for a lightweight form of bookmarking places, as your searches are remembered.
  • As for coverage, Guam was added.
  • For developers, you can now start Rainy Days with a desired location using an intent. Contact me for details if you want 'em.

Under the hood lots has been changed again to improve stability and make it possible to add new cool features which I'm working on.

Another change that I'm making is that Rainy Days will be ad supported as of today. The main reason for is simple: Rainy Days is costing me money. How much depends on the actual use of Rainy Days, but since the app gets more and more popular, the costs will rise and I need a way to at least partially cover those costs. In the past I've received some donations through paypal and the donation app, but while they are very much appreciated, the current rate of donations isn't enough to be sort of sustainable. Thanks again to all of you who have donated!

For those of you who don't want to see ads, there's the option to upgrade from within the app for a small fee, which will disable the ads on all your devices forever. The next two weeks I'll price the upgrade at only $0.99 cents. Sorry, I can not auto-upgrade those who have previously donated due to technical reasons, I hope you understand. Feel free to contact me for further details.

I hope you'll like the new features! You can get the updated Rainy Days app from the Android market.

 

Permalink | Leave a comment  »

]]>
http://files.posterous.com/user_profile_pics/401452/image.jpg http://posterous.com/users/36UQBMgVchtD Hugo Hugo Hugo
Wed, 11 May 2011 12:29:14 -0700 New app released: Budget Coach http://code.neenbedankt.com/new-app-released-budget-coach http://code.neenbedankt.com/new-app-released-budget-coach

At Qbus we build great web applications and mobile apps. Just now we have released a new app: Budget Coach. Budget Coach is an app that helps you tracking your budget in a easy and simple way.

For this app we worked together with Nong Sudson at http://www.plasmastudio.nl/, who developed the concept and the design of the app. Check out some of screenshots and download it from the Android market today for free!

Permalink | Leave a comment  »

]]>
http://files.posterous.com/user_profile_pics/401452/image.jpg http://posterous.com/users/36UQBMgVchtD Hugo Hugo Hugo
Fri, 18 Mar 2011 02:46:00 -0700 Unquoted paths with Nginx and Trac http://code.neenbedankt.com/unquoted-paths-with-nginx-and-trac http://code.neenbedankt.com/unquoted-paths-with-nginx-and-trac

This took me ages to find so I'd better document it here. When switching to nginx from lighttpd I ran into some problems with the trac instance that was running through fcgi. After following most of the tutorials around to set it up, all looked fine. Then I ran into issue 9755.

To solve it I first tried to go the proxy-standalone-trac route, which has an unquote option to cope with this issue. But in that case my authentication through nginx would never work. In the end I went digging in the trac source code and found the FlupMiddleware class that is used when running in "unquote" mode for tracd. After some more digging I found that in Trac 0.12.2 this is integrated in the fcgi_frontend.py script that is distributed with Trac. 

So here it comes...To activate the unquoting just set the environment variable TRAC_USE_FLUP to true (actually anything but 0, no or false will do) and we're golden.

Hope that 'll save you some hours, like I wasted mine :)

Permalink | Leave a comment  »

]]>
http://files.posterous.com/user_profile_pics/401452/image.jpg http://posterous.com/users/36UQBMgVchtD Hugo Hugo Hugo
Mon, 31 Jan 2011 10:42:00 -0800 Small Rainy Days update: 2.0.1 http://code.neenbedankt.com/small-rainy-days-update-201 http://code.neenbedankt.com/small-rainy-days-update-201

After my previous post I did some bug hunting, and I got a response from a few users. With this info I have implemented (what I hope) a workaround for the slowness on Droid Eris.

I also fixed the few bugs that where reported through the automated Android error reporting so Rainy Days should be a little bit more stable now.

One thing that I can't stress enough is this: if you experience issues with the app, and you want those issues to be fixed, please, pretty please (sugar on top) contact me! Without any details I'm pretty much blind, which is frustrating to say the least :)

I hope you all enjoy the update! 

Permalink | Leave a comment  »

]]>
http://files.posterous.com/user_profile_pics/401452/image.jpg http://posterous.com/users/36UQBMgVchtD Hugo Hugo Hugo
Wed, 19 Jan 2011 03:43:00 -0800 What's wrong with Eris? http://code.neenbedankt.com/whats-wrong-with-eris http://code.neenbedankt.com/whats-wrong-with-eris

After releasing Rainy Days 2.0, I see some comments in the Android Market that suggest that Rainy Days is not working/slow/something else on Droid Eris. Unfortunately most of those people do not contact me, so I have no clue what's going on. I don't own a Droid Eris. I do own a HTC Hero however, which is about the same device. On that device Rainy Days works OK, maybe a little bit slower than before, but it works fine otherwise. I might be able to speed things a bit more for these, let's face it, somewhat older devices.

So Eris users, please contact me and explain the issue. Please also mention your connection speed e.g. what's displayed in the notification bar of your device (G, EDGE, 3G, etc). Also mention if you are using a custom rom or not.

Permalink | Leave a comment  »

]]>
http://files.posterous.com/user_profile_pics/401452/image.jpg http://posterous.com/users/36UQBMgVchtD Hugo Hugo Hugo
Wed, 12 Jan 2011 12:13:00 -0800 Rainy Days 2.0 http://code.neenbedankt.com/rainy-days-20 http://code.neenbedankt.com/rainy-days-20

Yay! For various reasons it has taken me a while to update Rainy Days, but now I'm pleased to let you know that I've just released version 2.0!

One of the top requests and bug report was that for the US the radar images sometimes where "cut off", for example on large screen phones such as the EVO and tablets. I've now fixed this technical limitation and in fact changed a lot on how Rainy Days loads the images. A direct result of this is that the "loading" screen is gone forever, just like the "refresh" button. Rainy Days will now automatically refresh the images, to save you the hassle.

Radar images are now also more up to date and, depending on the zoom levels, load faster. There is no more distinction between high dpi devices and low dpi devices.

Another issue some of you run into is the location that is reported. Sometimes network location just isn't accurate enough so I've added an option to also use GPS. You can find this option in the settings.

As for coverage: Puerto Rico was added and a big overlay from Eumetsat, covering places in Europe and Africa, really cool!

I hope you like the update, as always, feedback is very much appreciated.

 

Permalink | Leave a comment  »

]]>
http://files.posterous.com/user_profile_pics/401452/image.jpg http://posterous.com/users/36UQBMgVchtD Hugo Hugo Hugo
Sat, 25 Sep 2010 02:26:00 -0700 Rainy Days testers wanted http://code.neenbedankt.com/rainy-days-testers-wanted http://code.neenbedankt.com/rainy-days-testers-wanted

I'm looking for testers for the upcoming 2.0 version of Rainy Days. If you like to help me test it, please drop me an email! You can find the address in the Android market. (Yes, consider that a test :))

Update: Thanks to everybody who has helped me test 2.0! I've just released the new version.

Permalink | Leave a comment  »

]]>
http://files.posterous.com/user_profile_pics/401452/image.jpg http://posterous.com/users/36UQBMgVchtD Hugo Hugo Hugo
Sun, 12 Sep 2010 09:36:00 -0700 Engine Watch 1.4 released! http://code.neenbedankt.com/engine-watch-14-released http://code.neenbedankt.com/engine-watch-14-released

It's been a while, but I've updated Engine Watch today to version 1.4. Engine Watch 1.4 is almost a complete rewrite to add an important feature: notifications.

It is now possible to get a notification when a particular app is over its quota, and you can disable or adjust the notification per quota item that you'd like to monitor.

Another change is that Engine Watch 1.3 was "account centric" while 1.4 is "application centric". When you start Engine Watch you now select the application you'd like to monitor, removing the need to select an account first. I think this makes a bit more sense and easier to use :)

Check out the screenshots below and download Engine Watch from the Market by scanning the barcode

I've created a dedicated page for Engine Watch here with some more info and screenshots. Enjoy!

Permalink | Leave a comment  »

]]>
http://files.posterous.com/user_profile_pics/401452/image.jpg http://posterous.com/users/36UQBMgVchtD Hugo Hugo Hugo
Sun, 05 Sep 2010 04:31:00 -0700 Rainy Days radar clutter http://code.neenbedankt.com/rainy-days-radar-clutter-tags-android-rainy-d http://code.neenbedankt.com/rainy-days-radar-clutter-tags-android-rainy-d

Currently US radar coverage is filtered a bit more in an attempt to reduce radar clutter. Please let me know if you think this is an improvement or not. Obviously I can't go over there and check for myself :)

Permalink | Leave a comment  »

]]>
http://files.posterous.com/user_profile_pics/401452/image.jpg http://posterous.com/users/36UQBMgVchtD Hugo Hugo Hugo
Sat, 28 Aug 2010 12:41:00 -0700 Rainy Days update http://code.neenbedankt.com/rainy-days-update http://code.neenbedankt.com/rainy-days-update

While I'm still working on the next version of Rainy Days, I just pushed out an update for Rainy Days 1.9.
On some devices the settings screen could not be accessed and I've fixed this in 1.9.1, with the help of Karl Pearson, who was so kind to report the bug and test the fix.

For several reasons work on Rainy Days 2.0 has been a bit delayed, but I'm making progress, more on that in the couple of weeks!

Update: I noticed some crash reports in the Market console which I have fixed in 1.9.2...and that broke other stuff, so now 1.9.3 is out :)

Permalink | Leave a comment  »

]]>
http://files.posterous.com/user_profile_pics/401452/image.jpg http://posterous.com/users/36UQBMgVchtD Hugo Hugo Hugo
Fri, 09 Jul 2010 14:36:00 -0700 Android JUnit results in Hudson http://code.neenbedankt.com/android-junit-results-in-hudson http://code.neenbedankt.com/android-junit-results-in-hudson

A little while ago I wanted my unit test results for my Android apps that I build with Hudson. I tweeted about it, but forgot to follow up with some more details, so here it is.

Since I the default android testrunner does not output it's format in a xml suitable for Hudson, I decided to dig around and after looking at source for InstrumentationTestRunner I came up with this.

The com.neenbedankt.android.test.InstrumentationTestRunner extends the Android one so that an xml of the test results is written to the device when running the tests. To use this in your Hudson build you only have to take these simple steps:

  1. Add the testrunner to your project, and reference it in you AndroidManifest.xml (see here)
  2. Startup an emulator in your Hudson build using the android emulator plugin and launch adb to run the tests
  3. Pull the generated xml report file from the device and put it somewhere in your build dir so that Hudson can find it.

If all goes well, Hudson will pick up the results and use that to show the JUnit results.

For my own little projects it seems to work fine, although it I've implemented the bare minimum to get something working in Hudson.

Permalink | Leave a comment  »

]]>
http://files.posterous.com/user_profile_pics/401452/image.jpg http://posterous.com/users/36UQBMgVchtD Hugo Hugo Hugo
Sun, 13 Jun 2010 13:13:00 -0700 Rainy Days 1.9 http://code.neenbedankt.com/rainy-days-19 http://code.neenbedankt.com/rainy-days-19

Yet another update for Rainy Days, my weather radar application for Android! This update has a few new features and bugfixes.
First of all some display flickering that occured on the HTC Desire is now fixed. This also fixes any flickering you may have when running Froyo. I've also updated the app for Froyo (Android 2.2) so that you can choose to install the app on the sdcard.

For devices like the Nexus, Droid and HTC Desire I updated the menu icons so that they are of better quality. I also updated the application icon to make it more according to the Android icon design guidelines (judge for yourself if it worked out :))

Under settings there is now an option to access a few experimental features. One is smoothing of the animation that uses a fade effect. I got some mixed reactions on this from users so I decided to make it "experimental" and disable it by default. Let me know what you think! The other experimental setting disables the filtering of the radar images, which gets you more detail when you zoom in. The last option in the experimental section shows the status of the fallback mode that is in Rainy Days a few releases already, to help me diagnose problems more easily.

In the settings dialog you'll also find an option to make a small donation by buying Rainy Days Donation. Donating is optional, Rainy Days is not cripled in any way if you don't donate, I'm not forcing anything on you :)
As always there are many bugs fixed!

More screenshots are in my previous posts about Rainy Days.
You can download Rainy Days by scanning the barcode below, or by searching the Market for "Rainy Days".

Rainy Days barcode

Permalink | Leave a comment  »

]]>
http://files.posterous.com/user_profile_pics/401452/image.jpg http://posterous.com/users/36UQBMgVchtD Hugo Hugo Hugo
Fri, 30 Apr 2010 05:55:00 -0700 Rainy Days 1.7 released http://code.neenbedankt.com/rainy-days-17-released http://code.neenbedankt.com/rainy-days-17-released

Update: I've released 1.8 to fix a force close issue when loading the European overlay.

Another update to Rainy Days, my weather radar application for Android! This version features a few new options and fixes.

First of all, it is now possible to change the opacity of the clouds using the on-screen slider, for example if you like to see the map better. This is a per session setting, which means that the normal opacity is restored the next time you start the app.

There's also a new option to show your location on top of the radar images if you like.

Another change is that Rainy Days is now scaling properly on high dpi devices like the Droid and the Nexus and on lower dpi devices such as the HTC Tatoo. Short summary: it should now look a little bit better :) Also, on high dpi devices the image quality for Scandinavia and the US will be slightly better, reducing blur that was in the previous versions. Rainy Days will automatically select the higher quality images if your device supports it.

I hope you like this new version! Also if you like other areas to be added, let me know!

More screenshots here

You can download Rainy Days from the market using the barcode below or my searching for Rainy Days.
Rainy Days barcode

Permalink | Leave a comment  »

]]>
http://files.posterous.com/user_profile_pics/401452/image.jpg http://posterous.com/users/36UQBMgVchtD Hugo Hugo Hugo
Sun, 04 Apr 2010 03:08:00 -0700 How to render an Android view to a bitmap http://code.neenbedankt.com/how-to-render-an-android-view-to-a-bitmap http://code.neenbedankt.com/how-to-render-an-android-view-to-a-bitmap

Yesterday I was wondering how to render a view to a bitmap.
It turns out to be pretty easy, you can use the View.buildDrawingCache() and related methods for that. The only gotcha I ran in to that you'll have to layout the view yourself if you are instantiating the view outside of an activity.

Here is my working code:

Button b = new Button(context); b.setText("Hello World"); b.setDrawingCacheEnabled(true); // this is the important line :) // Without it the button will have a dimension of 0,0 // and the bitmap will be null b.layout(0, 0, 100, 100); b.buildDrawingCache(); Bitmap bitmap = Bitmap.createBitmap(b.getDrawingCache()); b.setDrawingCacheEnabled(false);

Permalink | Leave a comment  »

]]>
http://files.posterous.com/user_profile_pics/401452/image.jpg http://posterous.com/users/36UQBMgVchtD Hugo Hugo Hugo