Rebuilding CommuterPal with Azure Functions and CosmosDB

A few years ago I built an iOS called Commuter Pal. I never actually launched the app, since I tried to do *way* too much in terms of route planning and intelligent alerting. Since I didn’t actually commute myself, it was not something I could field test.

Fast forward to 2017 and I’ve been commuting for about six months now. I’ve tried a few different apps to help keep me ahead of delays, but most of the apps are aimed at the entire network and have loads of bells and whistles, so I gave up using them as they just didn’t help. Most of the time I’m already on the platform before I learn of a signal failure or ill passenger.

To coincide with the fact I’ve started wearing my Apple Watch again, I’ve decided to try and bring Commuter Pal back to life with a more simple goal; a watch complication that tells me if my route is clear or blocked.

My choice of tech is predictable – iOS (Objective-C) and .Net. This time, instead of my usual WebAPI approach, I’m going to try and build the whole thing with CosmosDB and Azure Functions. I’m not really sure how it will work, but I think that all phone interactions can be powered by HTTP bound Functions and calls to TFL for updates can be done using Timer based Functions. Throw in a queue here or there and an Azure Notification hub and we should be in business.

I’ll try and document the process as I go along.

If you’re an iOS user and commute using the London Underground, I’ll be making this app available for beta testing, so if you’re interested in taking a look, let me know!

Advertisements

Apple Pay with iPhone 5 and Apple Watch

Now that Apple Pay is live in the UK, I thought it was time to try it out. Initially I thought Apple Pay was limited to the iPhone 6 and that I’d be left out in the cold (until they release a new 4″ version of the iPhone), but I was informed it works with the Apple Watch on its own.

This isn’t the most obvious thing and the option to set it up isn’t the most obvious either! I’ve taken a few screenshots to show you how far I got. Which, sadly, wasn’t very far.

I’m running iOS 9, beta 3 and Watch OS 2, beta 2.

First, open the Watch app on your iPhone.

IMG_3247

Navigate to the Wallet app (or Passbook in iOS 8)

IMG_3249

You should now see an option to Add Credit or Debit Card. When I clicked it, I simply got an error. Probably due to the fact I’m running beta software.

IMG_3250If you get it working, please let me know. I’m tempted to switch bank just to avail of this platform. Barclays, it seems, are pushing their own bPay technology. I suspect they’ll keep that for a few months and then support Apple Pay anyway.

How to view your colleagues’ schedules at a glance!

I spent some time over the weekend tweaking the UI for Peopler. I think this version looks a little clearer and more distinct. I’ve also added a new feedback page to this version and I’m keen to see whether this makes a difference.

iOS Simulator Screen Shot 9 Feb 2015 10.16.26

Peopler lets you view the calendar’s of other people using Microsoft Exchange. You don’t need shared calendars or anything complicated, just the person’s email address.

Peopler is available to buy in the App Store https://itunes.apple.com/us/app/peopler-pro-check-availability/id954158903?ls=1&mt=8

This new version, with the updated UI, should be approved within the week!

Job Tracker beta testing

It’s been a week since my little brother, AKA beta tester prime, started using my Job Tracker app on his Android phone.

He’s an electrician and travels around doing work at a mixture of sites, commercial and residential, so an app that let’s him record accurate details of the work he has done could be very helpful. I delivered a build of the app to him using Google’s Alpha delivery mechanism, which is very simple I must say.

As with all apps, there were plenty of head scratching issues to work out. This proved to be very challenging, since my brother is in Ireland and I’m in England. I had two main issues, both beacon related.

It wasn’t detecting the beacons.

Since the app is build around the concept of iBeacon monitoring, this was quite a big one! I posted an Estimote beacon to my brother for the purposes of this beta testing. He basically placed it in a room and walked in and out of the room. The broadcast radius of the beacon was very low, so I was puzzled as to why it wasn’t recording the stops. There was no way to get an insight into the app (to read the logs) so I was diagnosing the issue blind.

They possible causes:

  1. The beacon monitoring wasn’t working at all.
  2. The location detection was generating an error and being swallowed.
  3. The call to my API was failing.

I ruled out number 1 by adding lots of Toasts to the Background Service. This allowed my brother to determine that it was detecting the beacons.

Number 2 was an act of faith. I had to assume that since the permissions were requested and the location services were switched on, that this was working okay.

In the end, it was a silly omission on my behalf. I had just updated the backend and added authentication. I was missing the Authorization header on one of the requests, so the app couldn’t successfully function. D’oh!

Sometimes it would fail to record an entry or exit

This issue proved to be more subtle. During the day, the app would work perfectly, or not at all. In some cases it would stop detecting the end or exit events. There were two possibilities. Either my code was crashing or Android was killing the Background service and not restarting it. I added lots more exception handling to the Background service and included an alert dialog so my brother would know if the service crashed. After a day’s use, this dialog never appeared, so I ruled out developer negligence. I switched the service over to a Foreground one. This eliminated the issue, but left me with a permanent dialog. I’ll revisit this once the app’s functionality has been improved.

There were, of course, other bugs in my code. Most very simple to squash.

This week should bring a full 5 days of uninterrupted testing and help me determine if the app is useful, annoying, pointless or somewhere in-between. I just completed an iOS version too and that’s being deployed to another brother. He’s a mobile mechanic, so this app is suitable for him too. I’ve got a beacon sitting in a Jiffy bag ready to post to him!

I’ve had an idea for a home-delivery beacon platform too 🙂

Tom

iOS Enterprise managed app configuration

With the release of iOS 7, Apple introduced support for managing an app’s configuration using a Mobile Device Management system. This allows enterprises to deploy apps and then control their configuration centrally. You could provide URLs or enable and disable features with the push of a button.

An app that supports managed configuration just needs to read a particular key, com.apple.configuration.managed from NSUserDefaults. This yields an NSDictionary which contains all the settings pushed to the app via the MDM. For my work with Roomr, I choose to support managed configuration so that the Exchange URL could be set and modified with ease.  The code changes are very simple.

Testing managed configuration is another kettle of fish. You can provide the configuration in one of two ways. Firstly, you can provide the configuration when the app is being installed or you can provide it after the app has been installed, effectively updating it.

To accomplish this, I used my own product, TestMDM. TestMDM aims to replicate many of the features of a MDM without replicating the large cost and complicated setup. It’s aim is to make it possible to test enterprise features without having to suffer the expense of purchasing an MDM. It also means you don’t need to trick an MDM provider into giving you a trial and then spending hours getting that setup.

To test my configuration, I used TestMDM to first install my app. Once I had successfully installed it, I then pushed configuration to it

image

I just click Queue and TestMDM takes care of the rest. I can debug my iPhone app at the same time and ensure the configuration is detected and loaded correctly.

If you’re interested, please check out TestMDM – I’m making improvements all the time so if a particular feature is missing, let me know and I’ll add it to the roadmap.

For developers who want their apps in large enterprises, supporting iOS7’s Enterprise features, such as single sign-on and managed configuration, is a no-brainer. Hopefully you’ll find TestMDM useful. If you have any questions, please get in touch!

Testing iOS Enterprise features without an MDM

Recently, I deployed a special version of Roomr to a large enterprise customer for inclusion in their Enterprise App Store. Part of the arrangement was that I support two enterprise features; Single Sign-On and Managed App Configuration.

This, on the face of it, was an excellent deal. I watched some WWDC videos on preparing apps for Enterprise and had managed to land a face to face meeting with the head of IT at this company. It seemed like a small amount of code would need changing in exchange for a tremendous financial opportunity (the company in question has over 120K employees world wide).

However, things are rarely as easy as they appear.

I immediately discovered, to my dismay, that the Managed App Configuration feature required a full MDM (mobile device management) platform to operate correctly. I searched the internet looking for MDM software that I could download and use for testing, but sadly I couldn’t find any. All of the major providers offer trial versions, but you have to get in touch with them etc. etc. As I wasn’t going to buy their software, they were understandable disinterested.

I knew I needed to test my software before releasing it, so I needed another approach.

I decided to build the software I needed to complete my testing. After some prelimiary research I discovered I needed to be a member of the Apple iOS Enterprise developer program. At £185, this was a hefty amount, but the potential earnings from a successful enterprise deployment made it worth the investment. I handed over my credit card information and got Cold Bear Ltd registered within the Enterprise program.

After getting the MDM protocol documentation (thanks to Peter Marcos at Apple for helping with this), I got to work. After much hair pulling, use of SSL and prolific swearing, I got a basic MDM solution working. Another few hours and I had tested my Enterprise code. I packaged up the IPA and emailed it to my client.

After the dust settled, I got an email from another developer who was having trouble testing the same Managed Configuration feature. After establishing that he would be willing to pay money for a simple way to test this feature (his MDM wasn’t working) I started refactoring my code.

After more swearing and hair pulling, TestMDM (http://testmdm.cloudapp.net) was born! TestMDM offers basic MDM functionality in a time-boxed fashion. You might want to test your app for an hour or a week and you only pay for the time you need. I hope this strikes a balance between the time and cost purchasing an MDM and the need to test some features quickly and effectively.

It’s almost ready for launch. I’m just putting the finishing touches to the device enrolment functionality to make it as easy as possible.

So, if you’re an enterprise developer or thinking of getting into enterprise development, TestMDM might be of use to you. If you’d like to know more, please drop me an email – tomas@coldbear.co.uk and I’d be happy to have a chat about what you need for enterprise development.

Tom

PS The name TestMDM is most likely to change Smile If you have any suggestions, I’d love to hear them.

Importing Apple Certificate to Windows

When generating certificates for use with iOS, be it push notifications or Passbook, it’s sometimes necessary to take these certificates and export them, so they can be used on a Windows machine. If you want to generate the certificates using only Windows, please read my post on that subject.

The process of exporting an existing certificate is thankfully straightforward.

First, open the Key Chain assistant and locate the certificate you want to export.

Screen Shot 2012-10-22 at 07.16.59

Click the small arrow beside it. This should expose the Private Key component. If this is missing, your certificate is not complete.

Screen Shot 2012-10-22 at 07.17.22

Select both of these rows and right click.

Screen Shot 2012-10-22 at 07.17.53

Choose “Export 2 items…” – Don’t worry, it will only generate one file. You’ll then be promoted for a password for your Private Key.

Screen Shot 2012-10-22 at 07.18.36

Finally, choose the location.Screen Shot 2012-10-22 at 07.18.29

You now have the exported certificate. Copy the file onto the Windows machine you want to import it to. Double click on the file to launch the import wizard. This certificate should now be ready to use!