Airport Guides 2.0 is now available on Android!

Airport Guides 2.0 is now available on Android – it’s free, check it out!

When I stop and think about it, I’m not sure why I keep this project up. I published the first Xamarin.Forms Android version 5 years ago, and since then the Windows development experience for “modern” apps has gone through a lot of changes. Instead of trying to patch things forward I decided to make a fresh start with the UI code. (although things are still similar enough that it wasn’t nearly as hard as rewriting it)

And I think that was the right decision, but it’s irritating that the Portable Class Library I used isn’t really a thing anymore, and I already know what we’re using now is going to change when MAUI gets released. The Android emulator I’m using is slow (although not nearly as bad as it used to be, seems around 3x slower than a phone) and some things on it just don’t work. XAML Hot Reload is very nice, but sometimes the XAML changes don’t get recompiled or something, so every time I try something and it doesn’t work I have to guess whether I think I wrote the wrong code, or whether I wrote the right code and I should just rebuild the app. And I didn’t remember this from before, but you can get some pretty cryptic errors for common things:

  • If you use the wrong x:DataType on an element you get an InvalidCastException at runtime (fine) with no information about what you were trying to cast from and to! (not fine!)
  • Similarly a NullReferenceException I caused got converted to a TargetInvocationException with no information (because it was during navigation, I guess?)
  • I wasted a solid half hour on a cryptic XAML error “Content is set more than once” before desperately Binging and realizing that’s what you get when you have an extra “>” at the end of a XAML tag. *angry face*

It also has the irritating property that I need to periodically go through and update the maps for all 90 airports, which also has the “every day this app gets a little more out of date” feeling. And it’s not a big moneymaker, not that any of my apps are; we’re talking less than $50 a year.

And yet I poured a bunch of time over the last few weeks into this partial rewrite. I think there are a few reasons I’m drawn to the app:

  • Despite my complaints above, being able to write C# code (that I could conceivably port to iOS one day) for an Android app is pretty neat!
  • I really do like traveling, and airports, and maps, and looking at airport maps makes me happy.
  • I feel a sense of pride having apps that I wrote (I use my Baseball Odds app all the time!), and I’m looking forward to using this again when we travel.
  • I have a vague sense that having apps that are publicly available is good for my…brand? image? I dunno.

Anyway, it’s done now so I guess I should stop dithering. Give it a shot if you have an Android phone!

Android development makes me angry sometimes

So I’m working on making an Android version of my baseball win expectancy finder, and things are going pretty well! (anyone want to beta test it??) Except…

I’m using Xamarin.Forms so I can write all my code in C#/XAML, which is neat! I was even able to add Google ads in just an hour or two thanks to this handy guide after some fighting with NuGet packages.

Then I decided to build it in Release and deploy it to my actual phone, and it started to crash on launch. The Debug version didn’t have this problem, and launching the Release build through the debugger did not give any useful information, but after some Binging and fiddling with some project settings I managed to at least see that it was crashing with an Android.Views.InflateLayoutException. Sadly there was no data in the exception or call stack or anything.

So, OK, I figured there must be something with my XAML, so I commented out everything except the main TabbedPage control, but that didn’t help. At a loss, I went back to Bing and Google (yes, pulling out the big guns!) and after looking through a bunch of links and trying a handful of random things I looked more closely at the log and saw a line like

W/resourcetype: entry identifier 0x14c is larger than 0x84

So OK, this looks bad, I guess, and after some more Bing/Googling, I stumble across a this StackOverflow question that points to this Google Groups thread with a suggestion that this is a bug in “HistoryRecord over in the framework” (?) is trying to read the theme, and there isn’t anything wrong with your code. So I try this suggested workaround of adding this to the top of styles.xml:

<style name=”Stub”></style>
<style name=”Stub1″></style>
<style name=”Stub2″></style>
<style name=”Stub3″></style>
<style name=”Stub4″></style>
<style name=”Stub5″></style>
<style name=”Stub6″></style>

These don’t do anything, they’re just there to try to work around the bug.

This didn’t work, but I figured “in for a penny, in for a pound” and added a few more, which also didn’t work. Then I changed them to the self-terminating XML tag form <style name="Stub" /> and lo and behold, the crash went away!

The kicker? That Google Groups post was from 9 years ago. This bug, which causes a crash on startup with no obvious cause and requires a basically-impossible-to-guess workaround has been around for at least 9 years.

*incoherent muttering*

switching from Windows Phone to Android: first impressions

Since my Lumia 950 is starting to act up, and Windows Phone basically has no future, I broke down and ordered a Pixel 2. Here are my first impressions after using it for an evening. Any suggestions are welcome!

– I’m using the Microsoft Launcher which is pretty nice I guess? I didn’t spend any time with the stock launcher so I don’t really have a good basis for comparison.
– No wireless charging 😦 Of course, this is paired with…
– Amazing battery life! The main reason I switched was because my Lumia 950 got comically bad battery life (like down to 80% by the time I got to work), and so I had to keep it on the wireless charging stand all day. (and this Lumia 950 was a replacement for the last Lumia 950 I had where this started happening and then eventually the phone would sporadically refuse to turn on because it didn’t detect a battery) We’ll see how the Pixel 2 holds up after more than a day, but I’m hopeful!
– No dedicated camera button, although you can double-tap the power button to launch the camera which is nice.
– I miss live tiles! Widgets are OK (although it’s very not-discoverable how to add them to the launcher), but they’re so big and non-standard.
– Having LastPass be able to sit in the notifications bar and fill in username/passwords in websites and apps is really handy, even though it is a bit buggy.
– The calendar situation is not good. I have two calendars that I care about – my personal Google one and my work Outlook one. On Windows Phone the Calendar app just merged them together, which was great! On Android the Google Calendar app doesn’t show my Outlook calendar and vice versa. The Outlook widget _does_ show Google Calendar entries, but that only shows the next 7 days.
– I don’t know how secure the fingerprint unlock is, but it’s very convenient and fast. (although maybe half the time it takes two tries, but it’s still darn quick!)
– The whole permissions situation is pretty good now that you can easily revoke permissions from apps. (why does the Washington Post app want access to my contacts? Denied!)
– I’m kind of particular on what I want for my work email. I definitely don’t want it to show up in notifications because I don’t want to be “forced” to see it outside of work, but I like being able to glance at it if I’m bored. On Windows Phone I could do this by having a live tile for it – the number of new emails would show up on the tile, and I could turn off notifications. As far as I can tell, if I want a number of emails on the app icon on Android it has to show up in notifications as well. Maybe I’ll like having no work email notification better…
– The Outlook app supports swiping emails one way to delete and the other to archive – why doesn’t the Gmail app??
– The Gmail app shows me the number of unread emails on it, which is very annoying as I often will leave emails unread until I get home and deal with them. (the correct behavior is to show you the number new emails since you last opened the app, in case anyone’s wondering 🙂 )
– It sure is nice having official apps for everything in the world that get regularly updated!
– But no builtin Podcast app? Did I miss it somewhere?