LivestockCity App: Connecting Android and MS server

December 29, 2017

Image of bull on a phone.
Sharing is caring:

Earlier this fall, I took a remote internship working on the first Android app for an early stage start-up, LivestockCity. The mobile team consists of two Android and iOS engineers. For the moment, I am the only Android engineer.

The first step was connecting to the data. Early on we learned that there were issues with the APIs. Not only was the documentation incomplete, but no one had any answers regarding how the APIs worked. With that knowledge, I decided to try an alternative approach and connect directly to the MS server.

Never having used a Microsoft server or any .Net product I visited the Microsoft website to gain a better insight into their servers. Quickly, I learned that Microsoft and Java are good friends. Microsoft and Android provide documentation and tutorials. However, the information provided was more documentation than tutorial. So, I decided to take a different approach and conducted an internet query “Connect Android to SQL.”

The internet query produced numerous results. However, the “all” results did not answer my question so, I tried the “video” tab. There I found two helpful videos: Connect Android App with SQL Server and Android Login Application with MSSQL Server Using JDBC. As a rule, I review several online tutorials to see the core concept implemented in several ways. The common thread between these two videos was using the internet protocol (IP) address and the database name to connect to the server.

Gathering requirements

First, I started by gathering the Internet Protocol (IP) address. There are five ways to discover the IP address of a website. For my purposes the online method is more efficient because it involves only three steps: One visit ipinfo.info. Two enter the full website address ex. Google.com. Three interpret the output. Then, I requested the database name from the back-end developer. With the IP address and database name, I was ready to create my Android project.

Screenshot

Android Studio comes with a login template that comes fitted with everything, plus you could need. However, Android Studio templates can be problematic. Also, the app needs to have a tablet layout, so I’m creating the associated XML simultaneously.

Full Stop

Implementing the code went smoothly. The online videos and tutorials were clear and effective in guiding me. However, I realized there was information missing. I needed an outline of the database structure to write my SQL query. When I queried the back-end developer for the database outline, I was informed that there was business logic preventing me from connecting directly to the database. This was devastating news that put a halt to all app development.

Next Steps

Without a working API, there is no way to get or post data to the database. For the time being I’ll work with the iOS team on the documentation and consider other areas of the app to develop.

The District Nerd YouTube channel

Leave a comment

Your email address will not be published. Required fields are marked *