Using Azure App Service and Xamarin to build an affordable satellite-communications app with Soremar
Airtime billing can be costly for fishermen who need to communicate with the rest of the world when they are out sailing. Soremar Group decided to build a low-data communication service to help them communicate. The solution would allow a sailor using his normal phone from within his boat to chat with other people on his contact list.
To lower the amount of bandwidth used and keep airtime billing under control, the solution allows messaging only. It consists of a mobile application connected through an access point on the boat that is then satellite-connected through Microsoft Azure web services to the rest of the world. The mobile app is an Android app developed with Xamarin, the back end being hosted on the Web Apps feature of Azure App Service.
Key technologies used
- Azure App Service
- Azure Application Insights
- Visual Studio
- Azure SQL Database
- HockeyApp
- Xamarin
Project team
- Ali Najibi – Project Manager, Soremar Group
- Yassine Serhane – Technical Evangelist, Microsoft
Customer profile
Soremar Group is a leader in marine electronics in Morocco. It has a wide range of activities, ranging from port activities to boating and sea safety and from radio and satellite communications to defense and security operations. They are present in each and every one of the Moroccan harbors. Soremar Group also manages a solution for tracking all Moroccan fishing boats that are used by the Office of Fishery and Fishing Companies. Using Moroccan resources, Soremar and the Office of Fishery and Fishing Companies also provide airtime communication to these fishing boats.
Problem statement
Business pain points
Fishermen would love to communicate with their families and friends when out for sailing or cruising, but there is no GSM coverage out on the sea; they have access only through satellite communication. This means that airtime billing would be incurred, and this can be very expensive. To provide them with a way to communicate over the Internet while keeping airtime billing under control, Soremar wanted to build an affordable messaging application to help the sailors communicate with the rest of the world (other fishermen, central base, families, friends, and so on). Because this is not a usual service, Soremar was uncertain how readily users would adopt the solution and how the various parties would use it. They also needed to release it quickly and begin testing in the real world.
Technical pain points
Soremar had the following concerns that they wanted to address:
- Restricting the network communication in the boat to the application requests
- Having a load-balanced service
- Ensuring high availability of the service
- Ensuring elasticity of the service so that they could start small, increase resources as needed, and resize anytime depending on usage
- Ensuring easy monitoring of the service
“When we thought about FleetChat, we were concerned about the costs of setting up the back end, configuring it, and maintaining it. Microsoft Azure was the right solution for us to deploy our service, test it, scale it on the fly, make it available 24/7, and benefit from an active backup strategy while optimizing the costs of the whole solution.” —Ali Najibi, Project Manager, Soremar Group
Solution, steps, and delivery
We worked very closely with Soremar on this project from consulting to architecture design and development. To tackle the business challenges, we suggested Azure as a platform that could give them the agility and flexibility they need both during the dev/test period and for production, allowing them to start this project with a low investment and scale as it grows. We agreed to build an instant messaging app cloud-backed with a .NET web service based on the ASP.NET SignalR library, which is best suited for real-time instant messaging. We decided to host it on Azure to benefit from its elasticity and scalability and the easy integration of analysis tools (Application Insights). We wanted to start with hosting a small project and then enable autoscale during the pilot phase to control the cost of providing the service.
We came up with the following architecture:
Based on this architecture, Soremar developed a simple messaging web API based on SignalR and hosted it on Azure App Service. The web API is consumed by an Android application built using Xamarin. To provide connectivity on the boats, Soremar installed access points on the fleet being monitored, allowing in-out communication only for Azure-related queries for the FleetChat application.
Create the back-end web API
The web API provides authentication, subscription, contacts management, and messaging.
Create the Xamarin app
Login screen
Chat screen
Database model
SQL database in Azure portal
Entity relationship diagram
Authentication
Client-side authentication
Server-side authentication
A user enters his or her username and password. These are sent to the server and checked against the database. If the credentials are valid, a token is generated and returned to the client app. This token is then used in all subsequent requests.
User behavior with HockeyApp
Because Soremar needs to know how each type of user behaves with the application, we suggested using the HockeyApp service. This would offer the ability to collect app-usage metrics. One challenge remains: storing metrics locally in case of limited Wi-Fi connectivity and later synchronization, thus avoiding additional airtime or connectivity charges.
For testing and debugging, we integrated crash reporting by adding the HockeyApp package to the project and a line of code to MainActivity.cs.
using HockeyApp.Android;
namespace SignalR_Client
{
[Activity(Label = "FeelChat", MainLauncher = true, Icon = "@mipmap/icon")]
public class MainActivity: Activity
{
protected override void OnCreate(Bundle savedInstanceState)
{
base.OnCreate(savedInstanceState);
CrashManager.Register(this, "XXXXXXXXXXXXX");
}
}
}
Conclusion
Soremar was astonished by the rapidity of implementation using Azure services. By empowering them with cloud services, they are now able to focus on what matters the most and delivering a solution tailored for their customers.
In a very short period, Soremar created a near-to-complete solution that fishermen could start using to chat on Android. A user can sign in, view a list of people with whom he would like to chat, select a name, and start sending instant messages.
Building the app using Xamarin allowed them start developing for Android with C# without going through the hassle of learning a new language. They felt that Microsoft gave them the right tools to speed up their development and launch the project.
Additional resources
- SignalR web app sample on GitHub
- Getting Started with SignalR 2
- Getting Started with HockeyApp for Android