Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Which is best firebase or php and json with mysql for android app?

I am confused in between Firebase and etc websites that provides backend services and in using php and mysql with a hosting for my android app. What should i choose and why will you please suggest me. I have searched many times on google and youtube but still didn't get any proper answer.

like image 586
Anshuman Kaushik Avatar asked Dec 18 '22 14:12

Anshuman Kaushik


2 Answers

Of course it depends on your needs,
Choose Firebase

  • If you need to use real-time database eg. online chatting app
  • if have not worked on server side programming languages before
  • Want to build the backend part of the app in shorter time. Firebase simplifies the development process
  • Free if you have users less in ten thousands of users (assuming you don't use intensive data storage)

Choose PHP/MySQL when

  • If you like the concept of relational database
  • If you are familiar with a server-side programming language
  • If you like to use SQL queries
  • Will be cheap if you have more than hundreds of thousands of users or you use intensive data storage.

Generally if your project is used by many users firebase is expensive(eg. above 10,000 monthly active users), but for a simple project it is easy to setup, saves you server cost.

like image 95
Aman Avatar answered Jan 04 '23 22:01

Aman


You'll need to keep in mind that there's usually two concerns here: A local database kept on the device and a server database that the device interfaces with over an API.

The local database should be something quick, simple, and efficient. Perhaps Firebase is a good fit for your project, but SQLite is also very popular.

The server database is typically something more robust, with emphasis on data integrity, scalability under heavy load, and features that make managing larger amounts of data more practical. MySQL is one example of this, but Postgres and MongoDB are also very popular.

It's important to remember that your mobile application will need to interface with the database over an API which is where a language like PHP comes in handy. JSON is a very popular format with a light-weight syntax and support in pretty much every language and makes a good transport encoding for arbitrary data. A JSON-based API is very quick to implement and yet will serve you very well in the long-run, enough that most mobile apps use some form of this for communication.

Interfacing directly with a centralized server database such as MySQL from your Android app is a terrible idea and will lead to endless trouble: The MySQL security layer isn't capable of making fine-grained distinctions between various types of access. A proper API gives you complete control over what can and can't be done through your service and what can be read from or written to the database.

like image 26
tadman Avatar answered Jan 04 '23 23:01

tadman