Most common misconception among beginner Mobile App Developers

Damodar Lohani
4 min readFeb 18, 2020

--

In this article I would like to clear up the common misconceptions between beginner mobile app developers. In many mobile app groups that I follow I find questions from beginner developers like how do I connect my mobile app to a MySQL server or a SQL database? How do I dynamically load data into my mobile application from my database? This is the same kind of questions that used to pop into my head, back when I was beginning with Android development.

The very first thing you need to understand is that a mobile app remains in mobile of your users, however your data or your database remains in a server. And that is what makes it accessible to all the instances of your application installed on millions of users mobile phone.

Next thing you need to understand is, we do not directly connect to the database from our mobile application, at least it is not secure and not the right way to do. So how do we connect our mobile application to our database or load dynamic data from server to our mobile application. This is where the API comes into play.

API (Application Programming Interface) is a standard that allows interconnection between various different services and that is how we connect our mobile app or front-end to a our back-end service for our database server.

Now getting into the point. How do we connect our mobile applications developed in flutter or in Android or iOS to our database? To store data on server we use databases like MySQL or SLQ Server or MongoDB or any database and to connect to the database we write a code in languages like Python or PHP or java or any other language that support connecting to database and writing a backend services. Using those services we create a API, most common is the REST API.

A REST API is just a collection of URLs that we can call from our mobile applications using the libraries and services provided for our application development framework. Let’s say for an example we have a database of users and we want to add a new user from a mobile application to our database when user signs up. How it happens is first we create our in our API we expose a URL suppose, let’s say example.com/add-user and we write a code so that whenever someone sends a data in that URL our back-end application will connect to the database and store the data in the users table. And, in our mobile application, let’s say Flutter, we use libraries like http, to call that URL and send the data received from our user to that URL.

Now let’s say we want to retrieve that users data in our mobile application. For that we create and expose yet another URL in our API, for example let’s say example.com/users and when our application connects to this URL or request data from this URL or back-end application will connect to the database, retrieve the list of users from users table and send it back to this URL. This is in general how our mobile application can connect to the database server.

So, do we always need to create our own API for our mobile applications? The answer to this question is both yes and no. If you want our own database server and own logic to handle our data then we have to write our own API for our mobile applications. However nowadays there are many services like Firebase, back4app and other headless CMS that provides us API, for our mobile applications for any front end applications. This way we do not have to write own API however our mobile app needs to connect to their API and follow their API standards and structures to write and read data to the database server they provide. Each of these services have their own API and set of standards that we need to follow.

So to get started with mobile app development where you want to provide dynamic data for your users to manipulate, you either need to create your own database server and write your own API or use one of the managed database services like Firebase, Contentful, Back4App etc.

For those of you who would like to develop a complete mobile app from scratch using Flutter but don’t want to write your own API, I have created this awesome tutorial, on creating a complete App from scratch using Flutter and Firebase. Do check it out.

Want to connect with me
Facebook: https://fb.me/lohanidamodar
GitHub: https://github.com/lohanidamodar
YouTube: https://youtube.com/c/reactbits
Twitter: https://twitter.com/LohaniDamodar
Linked In: https://www.linkedin.com/in/lohanidamodar/

--

--