Mobile App Services

Starting on a mobile app can be a daunting proposition.

Your stakeholders at Rex’s Gym really need this app to help drive customer retention, promote the business, and make payments a breeze.

Getting the development environment set up, learning a new language, understanding a wholly different API for screen layouts per-platform, having to go to the Apple Store and buy a Mac (which is the absolutely last thing you thought you would ever do).

Stress, headaches, pain, mayhem, churn! You haven’t even started yet! Then suddenly a manager says that you need:

  • Source control
  • bug tracking + task tracking
  • A reliable build system
    • Have all Alpha and Beta builds be installable to any mobile device within the organization
  • in-app usage tracking and phone-home crash logging
  • push notifications
  • OAuth2 based login to existing back-end systems
  • in-app payment + in-app recurring subscriptions
  • … and to top it off your boss wants an integrated SMS based text message e-mail gathering t-shirt promotion

You go out and look at the Apple, Google, and Microsoft references for all that stuff. Have a slight heart attack after scanning through hundreds of pages of doco. Go home. Have a beer. Lose some sleep. Go for a run. Then you stumble into this blog post that will give you pointers to make all that stuff easier and more reliable than if you had to do it all on your own.

Please note: Where possible I have tried to make service choices that have libraries and connectors that work across iOS (Obj-C / Swift), Android (Java), UWP / Windows 10 / Windows 10 Mobile (C# / XAML), and cross-platform mobile app solutions like Xamarin or Ionic / Cordova. As with all things, your mileage may vary.

 

Source Control Options – Just use Git, but hosted where?

Source control for projects now has many cloud based options. Most of them also integrate to task tracking and documentation services in diverse ways.

Depending on your preferences and cost profile, there are many awesome options for source code hosting. I have found that the options tend to settle down to 2:

A dark horse here would be to checkout Visual Studio Team System to host your Git repo.

Be sure to check out our other SuperDevelopment article regarding source control best practices for a great overview.

 

Bug / Task Tracking

For bug / task tracking there are many options. These options may be dependent on choices you make for source control hosting.

If you want industrial strength task management + work items integrated with your source control, then consider Atlassian + Bitbucket + Jira.

If you want something more lightweight, then go outside of the box and take a look at Pivotal TrackerTrello, or Github issues.

I think that the key here is to create an always available, fully transparent, one-stop-shop for all bug and task tracking. Things like e-mail, Slack, and other communication schemes tend to fall apart really quickly when the number of people working on a mobile project is greater than (or even sometimes equal to) 1.

 

Mobile App Build Server Options

You took the morning and you settled on source control and a good task tracking system. The first task you put in your tracking system is: Setup a build server.

As a corollary to setting up your build server, you would also really like options for continuous integration and continuous builds as you commit changes. You are just one person, and you have 15 stakeholders. The more you can automate, and the more builds you can get out there, the quicker you will solidify the decisions of those 15 stakeholders.

For mobile app build systems + full app CI you have a series of good options:

  • Bitrise – A fully cloud hosted build system that lets you snap together your build process. Has integrations to Github and Bitbucket. It even lets you build those pesky iOS projects because they handle a virtual in-the-cloud Mac to handle the Xcode command line stuff. With Bitrise you can be up and running in under a day.
  • Jenkins – An on premise solution. Only tackle this if you have a spare Mac laying around. Could take 4-5 days to rev up Jenkins and make it reliable. Plus ongoing maintenance. Overhead is worth it if need a fully on site solution.
    • The recent shipment of Blue Ocean by the Jenkins team really starts to make the Jenkins build system look like a great option.
  • Visual Studio Team System — If you have Microsoft Azure credits, then take a serious look at VSTS for mobile app building.

 

 

Special Note: Fastlane Toolset

You start revving up your builds, and start to notice some badness: The Apple Developer Portal has all these crazy requirements for certificates, provisioning profiles, app IDs, Ad-Hoc provision, App Store provision … Arrrgh!

Fastlane match is here to solve all that crazy cert, provisioning profile, app ID stuff by tooling up against these guidelines.

Fastlane also solves many other problems:

  • Pilot – Command line publishing of your iOS builds to iTunes Connect / TestFlight
  • Snapshot – Creates localized screenshots of your app which you can use for per-country app submission to the Apple App Store.
  • and so much more.

To document all the greatness that is Fastlane would take hundreds of pages. Suffice it to say, relax, lean back, and learn to love Fastlane.

 

Alpha / Beta Build Distribution – HockeyApp

While revving up your build system, you took a look at your next line item: Easy distribution of Alpha and Beta builds to any mobile device, usage tracking, and phone-home crash logs. In this realm, I really recommend:

  • HockeyApp – It really does it all.
    • Easy integration path as an app binary output destination with all of the above build systems.
    • On-device app which creates a mini-app store for distribution of your Alpha and Beta builds to your internal customers.
    • Easily integrated usage tracking and crash log reporting API for iOS, Android, Windows, and Xamarin based applications.
      • You can even use all the usage tracking and crash log reporting for your shipping application, not just for Alpha and Beta builds.

Other app tracking services are out there, but the ‘one stop shop’ of HockeyApp, in addition to Microsoft backing the product, makes HockeyApp a very slick solution especially if you are in a hurry.

 

It has been a couple of days, and you have all your build infrastructure revved up. Your initial Xcode project is up in Git source control, the app is building automatically on every commit / push via Bitrise, all that provisioning profile / certificate stuff is on auto-pilot with Fastlane – match, and you even have your first ad-hoc build installing to your personal iPhone via the HockeyApp app. All is right with the world.

Now you tackle a couple of screens from your requirements, and meet your first sprint deliverable. Your stakeholders are amazed that you were able to deliver the app to their specific devices after only 2 weeks.

The new sprint comes up, and you look at some of those bigger items on that task list. The next task you know you need to tackle is push notifications.

 

Push Notifications – Urban Airship

IMHO the first place to go is Urban Airship.

There are other services out there, but nothing scales out and up with your business messaging needs quite like Urban Airship does.

In my experience, I was able to hand over a restricted role based login from Urban Airship to my primary stakeholders and watch as they created and sent push notifications out to the app with ease.

Urban Airship’s per-platform integration options are second-to-none as far as ease of app integration.

Everything may depend on your cost requirements especially as it relates to projected number of users and needed level of messaging.

It took a couple of days, but you now have Urban Airship integrated, a development messaging environment is now delivering push notifications to your app, and you are ready to tackle the next item.

Alternatives to Urban Airship for push notification handling include:

 

In-app OAuth2 Login

The customers login to the current web site using a series of web based OAuth2 login schemes against a custom back-end server. Your app has to integrate into those same login schemes. Even worse: They also want you to be able to handle login via Facebook, Google+, and Twitter.

Just to pile on, your stakeholders demand that you find a way to not ‘just embed a web view’ to do the primary OAuth2 based user login. It’s OK, they might understand you have to show a web view for Facebook, Google+, Twitter, and other social network pairing but they don’t want to see a web view for the primary app login. As much as possible your stakeholders want pure native views for all logins.

There are frameworks out there to help you do this, but they can seem scattered and hard to integrate per mobile platform per social network. Windows 10 / UWP especially seems very complicated as far as doing a native OAuth2 based login, getting back the user roles by cracking open a secure JWT, all without a web view.

There is a third-party service that may be able to help. In this case the service is Auth0 (pronounced Auth Zero). Auth0 provides a wrapper / helper depending on server login type as well as a full suite of per-mobile platform front end login API connectors.

The mobile app integration for Auth0 divides into 2 general schemes:

  • Lock — Auth0 presents all needed views, web views, and other login UI for you.
  • Client API — Allows you to code a fully native UI yourself and just passthrough username / password and other login configuration parameters via a pure API.

Worthy mention: Amazon Cognito.

 

Intermission

You are about 3-4 weeks in so far. You have major app screens up. Your boss loves the notifications, she even gets them on her Apple Watch. Your product managers are floored at the awesome login integration. You have already forgotten about all that build / signing / provisioning / app distribution stuff because all you do is commit, and the build pops out of HockeyApp automagically and installs to your internal test and stakeholder devices.

Well there was that whole crazy Ad-Hoc build headache with adding UDIDs of the designer’s main devices but Fastlane made that easy via register_devices

 

In-app Payment + In-app Subscription

Your stakeholders are getting itchy. They want $. They want to make sure that you are looking at in-app payment and in-app subscription schemes. Next sprint comes around, and you start to look around at options (I mean, you need to get $ too, right?).

Your business doesn’t have a payment system in place that you can easily integrate with. You start to sweat a little. Until you find Braintree Payments.

You look at the Braintree client list and realize that you have bought stuff through them and never even realized it.

You sign up for their sandbox. Do some preliminary app integration. The stakeholders are kinda ‘Meh.’ when it comes to a few issues. Then you go for the throat and show an in-app  Apple Pay integration with your sandbox. That demo just showed you buying a recurring membership to Rex’s Gym with your thumbprint. How is that not made of pure awesome!

You also looked around and found out that Urban Airship has a similar system.

 

T-shirt e-mail gathering promotion?

You pop your head up at 6PM on a Friday after an all day coding frenzy, go get a Diet Mountain Dew. Close your eyes. Stretch. Open your eyes. Wha… your product manager is dangling a t-shirt in front of your face.

It is a cool t-shirt. You are working for Rex’s Gym and the design is awesome.

Your product manager says she wants you to fully engineer a t-shirt promotion from within the app. The end user is going to text their e-mail address via SMS to a phone number, it is your job to receive the text, process the e-mail address out of the text, and send out an invite e-mail from Printfection that allows the user to get their t-shirt.

She hands you the number that receives the SMS messages, and the Printfection credentials, and tells you go get it done.

So you look around and realize that Printfection has an API. But the last thing you want to do is code up a whole bunch of the stuff in the app, or even on a hosted server, to hit that API and manage the whole workflow of this promotion.

It is 6PM. It is Friday. Code haze has entered your brain from the all day binge. A sunny weekend awaits you! Help!

So you look around some more and find Zapier.

Zapier lets you setup a ‘zap’ that fully automates the whole flow:

  • SMS is received
  • Scan SMS for e-mail address
  • Log e-mail address in a Google Sheet
  • Send Printfection invite to e-mail address.

… all of that with no code to create, maintain, or host.

Special thanks to Ben Peter of Zapier for his presentation at minnebar 11 for this one!

 

Worthy Mentions

Azure – iOS Developer Center – Can handle push notifications, single sign-on, and many other data handling scenarios.

Firebase – Owned by Google. Handles many back-end services, including push notifications, usage tracking / diagnostics, and much more.

 

Integration Testing Best Practices

We’ve already covered the best practice of Automated Unit Testing. Unit testing has many benefits, but there are times when you need to be able to test how multiple units of code work together.  This is when you need Integration Tests.

[Read more…]

Best Practices for Dependency Injection

Dependency injection (DI) is a design pattern meant to transform hard-coded dependencies into swappable ones, generally at run-time. DI is the primary mechanism by which to implement Inversion of Control (IoC) techniques to load dependencies at run-time as well as the most effortless way to swap dependency implementations with mocks or stubs for unit testing. DI is a best practice that yields more readable and maintainable code due to the way all of an implementation’s dependencies are knowable at-a-glance and by the amazing side effect of creating easily testable code.
[Read more…]

Automated Unit Testing Best Practices

Having a suite of automated tests for your code helps improve software quality and maintainability in several dimensions. Writing unit tests for your software is likely to cause you to incorporate several design aspects that make it easier for other developers to use your and which have the side-effect of dramatically increasing the maintainability of your code overall. Testable code typically has fewer tight couplings between components, dependencies that are injectable, and encourages SOLID design principles in a naturalistic way because SOLID code makes writing tests (and therefor all usage) of your code easier. Automated unit tests also help you write a verifiable usage contract between your components that enables you to find and isolate bugs or perform major refactoring on your code without fear of breaking existing features. All of this leads to higher quality software.
[Read more…]