The online home of John Pollard

More Reliable Background Notifications

I’m really happy with the “Show the days left as a counter on the app’s badge” feature on Count The Days Left, but unfortunately due to the way Apple implements background fetches makes it a little unreliable in staying up to date.

The latest version of the app fixes this by using push notifications to regularly wake the app to update itself.

Background fetch is unreliable

The problem was that I was using the background fetch feature to run the app in the background every so often, and when it runs update the number of days left on the badge.

However, the frequency the background fetches are run is completely down to the operating system. Now as far as I understand, iOS will allocate background processing time based on how often the app is used.

Obviously this causes a bit of a logical error. If the user enables the badge to show the number of days left, they are a lot less likely to open the app - which obviously means it’s less likely to run in the background, so is more likely to be wrong :(

Push notifications solve the problem

The best way of fixing this issue is to send out regular push notifications to the app, so it’s guaranteed to wake up and refresh the badge count.

In an earlier post I wrote about how I’ve found Azure the easiest way to set up the server side of things, and I did the same here.

I then send out notification with "content_available": 1 in the payload, which will not show anything in the Notification Center to the user, but the app will wake up in the background and run the code to update the app.

Obviously this means setting up some (minimal) server infrastructure to manage this. I’ve written a NodeJS script that triggers the push notification via the Azure API, and setup a cron job to run the script every 6 hours.

So far for me this has worked a treat, and I’m much happier with the solution even though it took a bit more work.

The new version of the app (v2.0.4) is available on the App Store right now.

Android vs. iOS Development

I’ve recent just shipped the same pretty simple app on both Android and iOS, so I thought it would be interesting to capture my current feelings on what is nice - and not so nice - about developing for each platform.

Big Caveat

I’m a lot more experienced building for iOS than for Android, so I’m almost certainly biased towards Apple. Don’t hate me.

Android Good Points

Release Process

Now Apple is getting much better at reviewing apps - my last few releases have all been out in less than 2 days - but it’s really nice to be in full control on when I can push out a new version.

The Google Play developer web site is also more comprehensive than iTunes Connect.

Image Generation

I love the image generation tool in Android Studio, which lets you generate all the image sizes you need for different screens resolutions from one original source.

I also love you can easily generate images from text, which was perfect for use make Font Awesome based icons.

iOS Good Points

Layout

I truly don’t understand exactly how all the different layout options work (LinearLayout, RelativeLayout etc.) Also the visual editor in Android Studio didn’t work well for me, so I ended up working in XML most of the time. That wasn’t fun.

It may be because I’m used to it, but the “storyboards plus constraints” way of laying out UI elements in Xcode seems much easier and much more intuitive to me.

I see there is a ConstraintLayout coming in AndroidStudio 2.2, so maybe that will make things easier in future.

Foundation Libraries

IMHO Out of the box, a basic iOS app is simply nicer looking and easier to use than an Android app. I think the foundation classes on iOS are just better designed. I had to do much more work on Android to make my app half-decent looking, especially with my limited design skills.

Xcode

Android Studio is just a little less polished to my eyes. Almost certainly this is because it’s cross-platform, and in a few places you can see this where there are non-standard UI elements used rather than platform specific ones.

It’s not that it’s terrible to use, but Xcode just feels faster and looks nicer on OS X.

Summary

I still think developing iOS apps in Xcode is easier and frankly more fun than the Android Studio/Android equivalent.

However I was pleasantly surprised how much things have progressed in Android Studio since I first played about with Eclipse a few years ago, and I’ll definitely consider doing more Android work in future.

Daily Optimiser v3.2.0 Available

The latest version of Daily Optimiser - v3.2.0 - is now available on the App Store.

There are quite a few small but significant changes in this version:

  • A cleaner UI to make the actual useful information stand out more
  • Share or print your daily agenda
  • 3D Touch launch options for newer iPhone users
  • The app now remembers whether you were last viewing meetings or tasks on launch (iPhone only)
  • Simpler help options

It was fun supporting printing, as previously I thought it was harder to implement than it actually was. Basically you can pass in some HTML into a UIMarkupTextPrintFormatter object, and then pass that as one of the activity items into a UIActivityViewController.

Pixagogo Out

As expected, Instagram has now removed several of their API endpoints, so my Pixagogo app has now been disabled and pulled from the app store.

Not entirely sure why Instagram are doing this, but it’s their ball so they can take it home if they want to.

It was fun while it lasted.

Pixagogo Out.

Yeltzland Android app released

By “popular demand”, I’ve now made an Android version of my Yeltzland app.

Just like the iOS version, the app just makes it easy to read everything about the mighty Halesowen Town FC (Forum/Official site/Yeltz TV/Twitter/…) in one place rather than have to click around different places. There is no new content you can’t get elsewhere.

It’s my first Android app that made it as far as the Google Play Store, and it was interesting to port a relatively simple native iOS app over to Android - but I’ll leave my more technical observations to another post.

The first version of the app is available on the Google Play Store now.