How to setup Appwrite.io for Android with Retrofit.

Subhav Mathur
4 min readOct 3, 2020

--

Appwrite.io

If you are searching for a Mobile Back-end as a service (MBaaS) which costs you the lowest, high security and provides almost all basic development needs to be required for a developer to deliver good mobile software faster, then you're at the right place.

Appwrite is an open-source, Self-hosted Web and Mobile Backend as a service platform that is very easy to use and fast to integrate into your local machine as well as cloud servers.

According to Appwrite’s documentation, it states,

“ Appwrite provides you with a set of APIs, tools, and a management console UI to help you build your apps a lot faster and in a much more secure way. Between Appwrite different services, you can find user authentication and account management, user preferences, database and storage persistence, cloud functions, localization, image manipulation, scheduled background tasks, and more.

Appwrite is both cross-platform and technology agnostic, meaning it can run on any operating system, coding language, framework, or platform. Although Appwrite can easily fit the definition of serverless technology, it’s designed to run well in multiple configurations. You can integrate Appwrite directly with your client app, use it behind your custom backend or alongside your custom backend server. ’’

That's being said, Appwrite can run on any operating system as well as any programming language. You can even use it with your own custom backend server with its awesome SEVER APIs.

In this article, we will learn how to set-up your own Appwrite Backend Server for your Android project with the Retrofit library by taking advantage of appwrite restful APIs.

Appwrite and Docker Installation

Since Appwrite is a self-hosted backend server packaged as a set of Docker containers, therefore you have to first install a Docker-CLI for your
operating system.

Proper easy-to-read documentation for appwrite installation is here.

Create your first or new project

After successfully installing Appwite in your local machine all you need to do is sign-up or login to your new Appwrite console from http://localhost (or any other host you might have set up).

After logging to your console you will see a plus icon for creating a project at top slight left on the screen. Click it and give your project a name and access it after it has been created.

Your Appwrite Project Dashboard

Cloning the app repository into Android Studio

Clone the GitHub repository from HERE to your Android Studio.

Steps to follow after successfully building the above-cloned repository:-

  1. Inside the project open app/src/main/java/com/mainsm/appwritePlusAndroid/utils/Constant.java file.
  2. Change PROJECT_ID value with your project id.
  3. You can find your project Id in the setting section of your Appwrite project console.
Setting section of your project

4. After that, go to app/src/main/java/com/mainsm/appwritePlusAndroid/retrofit/RetrofitClient.java File.

5. There you will find the BASE_URL string, change the first part of that URL with your local IP address,

i.e. BASE_URL = ‘http://>CHANGE HERE</v1/ ’

Also, change the above BASE_URL in Constant.java file ( IMPORTANT FOR LOGGING OUT USER )

6. Click Run ‘app’ from Run Menu to execute the project.

Join the community Discord server!

Join the server by clicking here for clearing doubts or contributing to Appwrite.

That’s All

That’s all for now, after running the project successfully you will see the following screens (before and after login),

Login Screen
Home Screen ( After Login )

There is, register a user, log out user session from the current device, and log out user session across all devices feature within the project too.

If you like this article as well as the project or have some feedback or questions regarding it, do like and comment below.

Also, give a star to the repository if you liked.

Linkedin Profile

#Adios

--

--

Subhav Mathur

A Passionate Android Developer, Open-Source enthusiast and always ready for innovative ideas.