Map in iOS app

Navigation is a crucial part of many mobile applications today. We might not even realise that behind something simple as finding car for rent, food delivery or Pokemon hunting there are some big tech: GPS (satellites in the Space!!!), Google/Apple/Microsoft maps services and, of course, intelligent mobile device with plenty of microcircuit. In FitRadar we use maps services to help trainers set training location by selecting some infrastructure object (gym, stadium, public location) or set some point in unnamed location by the river or lake for many open area activities like yoga, cycling or as simple as walking.

There are simple and clear requirements for map services:

  • present map to set a point for location
  • clustering (show single point on map with number of events instead of plenty points)
  • address search

Personally I try to utilise native platform solution (when it exists) for any problem. Obviously, I started with MapKit. But there is no way to ignore Maps SDK for iOS from Google. Or even check Bing from Microsoft. Integration process for all of them is relatively simple. Some require developer account and developer key creation. But let’s compare how they work.

Map and pin

All three candidates can do simple map presenting and selection random pin with coordinates pretty well. Also displaying simple map vs satellite is very good in all SDKs. Google maps can use

Clustering

Clustering for MapKit is something they support almost out of the box. For Google Map there is custom plugin. Which seems to be supported for a very long time. I wasn’t able to find any Bing map. (Please, share a link in comments if I’m wrong.)

Address search

Google Maps SDK is and absolute winner in this category. For some reason only Google pays attention not only to world wide known places like London or New York, but it also knows something like tiny beach, on border of Riga, Latvia.

Of course, it’s not something you may advertise on WWDC, but local citizen will appreciate when volleyball trainer organise next meeting at “Salaspils pludmale” app will know exactly where it is.

Bonus

Another “+” for Google Map iOS SDK is ability to use app custom colors to match app desing. This design is a JSON file which can be edited manually (or at online editor) and shipped with app bundle.

Again, I wasn’t able to find similar functionality for Apple or Microsoft maps, but, please, feel free to add in comments if they exist.

Conclusion

So, for today, obvious choice is a Google Maps SDK for iOS. I hope some day Apple bring it attention to MapKit and make it useful for all customer around the world, including some tiny country like Latvia.

Except where otherwise noted, this work is in the public domain.

P.S. Visit our website: https://www.fitradar.me/ and join the mailing list. Our app is coming soon.

P.S.S. Text by Dmitrijs Beloborodovs

We’re hiring: UI/UX Designer

We’re looking for a talented UI/UX Designer to join our team at FitRadar as co-founder.

FitRadar is a new free app to find the best personal trainer or sports events in your local area, in any sport. Fitness is closer than you think. Coming soon.

Be part of a FitRadar startup team and actively take part in developing the products

Besides excellent design skills, here’s what we expect from you: 

  • strong communication skills
  • motivation and initiative
  • growth mindset
  • sense of curiosity
  • a responsibility
  • desire to make things better
  • English, Russian and Latvian
  • location: Riga or Latvia
  • analytical thinking and self-driven

If you feel up to the challenge of creating beautiful designs in a faced-paced, exciting, and collaborative environment, send us your resume (CV) and portfolio.

Join our team and grow with us as co-founder.

If you are interested, please share your resume: job @ fitradar . me

P.S. Please visit our website: https://www.fitradar.me/ and join the mailing list. Our app is coming soon.

Our journey towards serverless

Recently we were working on a ticket booking and booking cancelation feature in our Fitradar solution. In our solution the booking process consists of two steps: the place reservation in a sport event and payment. And in case the user for some reason didn’t make a payment the system should execute one more step – cancel the reservation. The process becomes non trivial when each step is done in separate environments – the reservation is done on the back-end, but the payment is done on the client’s device. The most challenging part was to figure out how to cancel the reservation in cases when payment was not made or failed.

So we started to look for possible solutions. Initially we were considering Background tasks with hosted services but we didn’t like the fact that the background task will be in the same process as our main back-end service and we have to make sure the process doesn’t shut down after the request is handled. And since we were using the Azure Cloud for hosting our beck-end services the next thing we started to look at was the WebJob which seemed a very good solution for our use case until we introduced ourselves to the Azure Functions. After some investigation we came to conclusion that Azure Service Bus with message deferral and Azure Functions would be perfect solution. The idea was to send a message to the Service Bus after the user has made a reservation. The Service Bus would deliver the message to our Subscription with 15 minutes delay and our Azure Function would cancel the unpaid booking. In order to receive the scheduled Service Bus message we needed to use Azure Function with Service Bus trigger.

Once we learned more about Azure Functions we decided to use them for other tasks as well that should be done outside the usual request – response pattern. One of such tasks in our solution was User Rating calculation. The task should run on a regular basis every Sunday night. This requirement was perfect job for timer triggered Azure Function.

We started to work on our serverless functions. After the function was scaffolded we started to add our business logic. And since we already had a solid CQRS architecture in place for the main back-end service and for each use case we were creating a separate Command that was using the rest of our infrastructure we wanted to add another Command for reservation cancelation use case, but we faced some .NET Core compatibility issues. Our backend runtime was targeting .NET Core 2.2 version, but our Azure Functions runtime was targeting .NET Core 3.1. Although we could just downgrade our Functions app runtime but the documentation strongly encouraged to use version 3.1, because Function apps that target ~2.0 no longer receives security and other maintenance updates. And so we started to migrate our back-end app to the .NET Core 3.1.

We followed official documentation but still struggled to make our third party libraries work again. The biggest challenge was to find a way how to make to work FluentValidation, MediatR and Swagger together. Once we updated the FluentValidation registration in the Startup file according to the provided documentation it switched off the MediatR Pipeline Behaviors. And once we found a way how to make Pipeline Behaviors work it switched off FluentValidation rules on the Swagger UI page. The Stackoverflow and Google couldn’t help us and we started to experiment with the available settings for FluentValidation and MediatR registration. After several hours of error and trial  we found one setting that made all three libraries work together nice and smooth. Here is the peace of code that made our day:

services.AddMvcCore().AddFluentValidation(fv =>
                {
                    fv.RegisterValidatorsFromAssemblyContaining<PlaceValidator>();
                    fv.RunDefaultMvcValidationAfterFluentValidationExecutes = false;
                    fv.AutomaticValidationEnabled = false;
                });

Now our Fitradar back-end can really benefit from all ASP.NET Core and Azure Functions provided functionality.

P.S. Visit our website: https://www.fitradar.me/ and join the mailing list. Our app is coming soon.