Official Appwrite Android SDK 💚 🤖

Overview

Appwrite Android SDK

License Version Twitter Account Discord

This SDK is compatible with Appwrite server version 0.8.x. For older versions, please check previous releases.

Appwrite is an open-source backend as a service server that abstract and simplify complex and repetitive development tasks behind a very simple to use REST API. Appwrite aims to help you develop your apps faster and in a more secure way. Use the Android SDK to integrate your app with the Appwrite server to easily start interacting with all of Appwrite backend APIs and tools. For full API documentation and tutorials go to https://appwrite.io/docs

Appwrite

Installation

Gradle

Appwrite's Android SDK is hosted on Maven Central. In order to fetch the Appwrite SDK, add this to your root level build.gradle(.kts) file:

repositories {      
    mavenCentral()
}

If you would like to fetch our SNAPSHOT releases, you need to add the SNAPSHOT maven repository to your build.gradle(.kts):

repositories {
    maven {
        url "https://s01.oss.sonatype.org/content/repositories/snapshots/"
    }
}

Next, add the dependency to your project's build.gradle(.kts) file:

implementation("io.appwrite:sdk-for-android:0.0.0-SNAPSHOT")

Maven

Add this to your project's pom.xml file:

<dependencies>
    <dependency>
        <groupId>io.appwritegroupId>
        <artifactId>sdk-for-androidartifactId>
        <version>0.0.0-SNAPSHOTversion>
    dependency>
dependencies>

Getting Started

Add your Android Platform

To initialize your SDK and start interacting with Appwrite services, you need to add a new Android platform to your project. To add a new platform, go to your Appwrite console, select your project (create one if you haven't already), and click the 'Add Platform' button on the project Dashboard.

From the options, choose to add a new Android platform and add your app credentials.

Add your app name and package name. Your package name is generally the applicationId in your app-level build.gradle file. By registering a new platform, you are allowing your app to communicate with the Appwrite API.

Registering additional activities

In order to capture the Appwrite OAuth callback url, the following activity needs to be added to your AndroidManifest.xml. Be sure to replace the [PROJECT_ID] string with your actual Appwrite project ID. You can find your Appwrite project ID in your project settings screen in the console.

">
<manifest>
    <application>
        <activity android:name="io.appwrite.views.CallbackActivity" >
            <intent-filter android:label="android_web_auth">
                <action android:name="android.intent.action.VIEW" />
                <category android:name="android.intent.category.DEFAULT" />
                <category android:name="android.intent.category.BROWSABLE" />
                <data android:scheme="appwrite-callback-[PROJECT_ID]" />
            intent-filter>
        activity>
    application>
manifest>

Init your SDK

Initialize your SDK with your Appwrite server API endpoint and project ID, which can be found in your project settings page.

import io.appwrite.Client
import io.appwrite.services.Account

val client = Client(context)
  .setEndpoint("https://[HOSTNAME_OR_IP]/v1") // Your API Endpoint
  .setProject("5df5acd0d48c2") // Your project ID
  .setSelfSigned(true) // Remove in production

Before starting to send any API calls to your new Appwrite instance, make sure your Android emulators has network access to the Appwrite server hostname or IP address.

When trying to connect to Appwrite from an emulator or a mobile device, localhost is the hostname of the device or emulator and not your local Appwrite instance. You should replace localhost with your private IP. You can also use a service like ngrok to proxy the Appwrite API.

Make Your First Request

Once your SDK object is set, access any of the Appwrite services and choose any request to send. Full documentation for any service method you would like to use can be found in your SDK documentation or in the [API References](https://appwrite.io/docs) section.

// Register User
val account = Account(client)
val response = account.create(
    "[email protected]", 
    "password"
)

Full Example

import io.appwrite.Client
import io.appwrite.services.Account

val client = Client(context)
  .setEndpoint("https://[HOSTNAME_OR_IP]/v1") // Your API Endpoint
  .setProject("5df5acd0d48c2") // Your project ID
  .setSelfSigned(true) // Remove in production

val account = Account(client)
val response = account.create(
    "[email protected]", 
    "password"
)

Error Handling

The Appwrite Android SDK raises an AppwriteException object with message, code and response properties. You can handle any errors by catching AppwriteException and present the message to the user or handle it yourself based on the provided error information. Below is an example.

try {
    var response = account.create("[email protected]", "password")
    Log.d("Appwrite response", response.body?.string())
} catch(e : AppwriteException) {
    Log.e("AppwriteException",e.message.toString())
}

Learn more

You can use following resources to learn more and get help

Contribution

This library is auto-generated by Appwrite custom SDK Generator. To learn more about how you can help us improve this SDK, please check the contribution guide before sending a pull-request.

License

Please see the BSD-3-Clause license file for more information.

Comments
  • Upgrade our issue templates to use GitHub issue forms ✍️

    Upgrade our issue templates to use GitHub issue forms ✍️

    Introduction

    GitHub has recently rolled out a public beta for their issue forms feature. This would allow you to create interactive issue templates and validate them 🤯.

    Appwrite currently uses the older issue template format. Your task is to create GitHub issue forms for this repository. Please use Appwrite's issue templates as a reference for this PR.

    Tasks summary:

    • [ ] Fork & clone this repository
    • [ ] Prepare bug report issue form in .github/ISSUE_TEMPLATE/bug.yaml
    • [ ] Prepare documentation issue form in .github/ISSUE_TEMPLATE/documentation.yaml
    • [ ] Prepare feature request issue form in .github/ISSUE_TEMPLATE/feature.yaml
    • [ ] Push changes to master and test issue forms on your fork
    • [ ] Submit pull request

    If you need any help, reach out to us on our Discord server.

    Are you ready to work on this issue? 🤔 Let us know, and we will assign it to you 😊

    Happy Appwriting!

    good first issue hacktoberfest 
    opened by Meldiron 7
  • Upgrade our issue templates to use GitHub issue forms

    Upgrade our issue templates to use GitHub issue forms

    Upgrade our issue templates to use GitHub issue forms

    Fixes #12

    Description

    • Add bug.yaml issue form
    • Add documentation.yaml issue form
    • Add feature.yaml issue form
    hacktoberfest-accepted 
    opened by Sin-Sumit 4
  • 🐛 Bug Report: getSession() throwing NullPointerException for sessions being created via email / password

    🐛 Bug Report: getSession() throwing NullPointerException for sessions being created via email / password

    👟 Reproduction steps

    Appwrite Version 0.12 / SDK Version 0.3.0 Create a Session via email / password, try to get the session via getSession()

    👍 Expected behavior

    Get the respective Session

    👎 Actual Behavior

    NullPointerException due to requiring providerToken not to be nullable. https://github.com/appwrite/sdk-for-android/blob/2d0eecda71f1d85a73f658a9ae08656197e204d4/library/src/main/java/io/appwrite/models/Session.kt#L147 Unfortunately this entry seems to be null when creating a session via email / password.

    🎲 Appwrite version

    Different version (specify in environment)

    💻 Operating system

    Linux

    🧱 Your Environment

    No response

    👀 Have you spent some time to check if this issue has been raised before?

    • [X] I checked and didn't find similar issue

    🏢 Have you read the Code of Conduct?

    bug 
    opened by SebastianTMo 3
  • toString() on a Map.Entry in Kotlin returns the value around [ ]

    toString() on a Map.Entry in Kotlin returns the value around [ ]

    https://github.com/appwrite/sdk-for-android/blob/609275595d65c750a7a0970312b21766ed526a6d/library/src/main/java/io/appwrite/Client.kt#L175

    it.value.toString() The toString function of a Map.Entry will add brackets around the string, which are then URL encoded to %5B and %5D which breaks the filter on the server side and returns nothing.

    For example, if you call Database(Client.client).listDocuments("123456", filters = listOf("[email protected]"))

    The URL generated will be http://192.168.0.1/v1/database/collections/123456/documents?filters%5B%5D=%5Bauthor%3Dme%40example.com%5D

    The expected URL looks like this http://192.168.0.1/v1/database/collections/123456/documents?filters%5B%5D=author%3Dme%40example.com

    see https://pl.kotl.in/leQ4MEljA

    bug 
    opened by JohannHilbold 3
  • 🐛 Bug Report: Persistent login is broken on Android 12

    🐛 Bug Report: Persistent login is broken on Android 12

    Appwrite Android SDK uses cookies to achieve persistent login and store user session. More specifically it uses https://github.com/gotev/android-cookie-store library to store cookies.

    But as is mentioned in https://github.com/gotev/android-cookie-store/issues/28 storing cookies does not work anymore on Android 12 and most likely support for it will just go downhill from now on due to Google policies.

    I am aware that this should be handled in Android Cookie Store library, but since safest way to tackle this is to migrate away to proper token authentication and not use library at all - I am leaving this here.

    At the moment it is not possible to use Appwrite Android SDK with Android 12. As soon as the app is closed, session is lost and you would have to login again and again.

    opened by zlmr 2
  • More encapsulation in the SDK

    More encapsulation in the SDK

    I think that all calls should return a better type than "OkHttp.Response"

    For example, wouldn't it be nice to type: val session = Account(Client.client).createSession("user", "pass") and then the session would be (for example) of the AppwriteSession type. That object could have members like "isSuccess", "sessionID" or stuff like that.

    With the current version, you have to type var response = accountService.createSession(email.toString(), password.toString()) var json = response.body?.string() ?: "" json = JSONObject(json).toString(8) _response.postValue(Event(json))

    Encapsulating the "Response" would also allow for a SDK side json parsing and also error handling. The AppwriteSession object I described above could contain an AppwriteException if the call failed, for example. But more importantly, it would remove the need to parse the json on the non sdk side.

    enhancement 
    opened by JohannHilbold 2
  • sdk architecture changes

    sdk architecture changes

    Architecture Changes (1). Paths are changed to singleton pattern for better code readability. (2). Introduction of global variables and extension functions to make code concise and increases code reusability. (3). Request type also changed with singleton pattern for code reusability and readability.

    opened by AndroidPoet 1
  • Appwrite 1.2.0 support

    Appwrite 1.2.0 support

    What does this PR do?

    (Provide a description of what this PR does.)

    Test Plan

    (Write your test plan here. If you changed any code, please provide us with clear instructions on how you verified your changes work.)

    Related PRs and Issues

    (If this PR is related to any other PR or resolves any issue or related to any issue link all related PR and issues here.)

    Have you read the Contributing Guidelines on issues?

    (Write your answer here.)

    opened by Meldiron 0
  • Dev

    Dev

    What does this PR do?

    (Provide a description of what this PR does.)

    Test Plan

    (Write your test plan here. If you changed any code, please provide us with clear instructions on how you verified your changes work.)

    Related PRs and Issues

    (If this PR is related to any other PR or resolves any issue or related to any issue link all related PR and issues here.)

    Have you read the Contributing Guidelines on issues?

    (Write your answer here.)

    opened by christyjacob4 0
  • feat: update for 1.0.0-RC1

    feat: update for 1.0.0-RC1

    What does this PR do?

    (Provide a description of what this PR does.)

    Test Plan

    (Write your test plan here. If you changed any code, please provide us with clear instructions on how you verified your changes work.)

    Related PRs and Issues

    (If this PR is related to any other PR or resolves any issue or related to any issue link all related PR and issues here.)

    Have you read the Contributing Guidelines on issues?

    (Write your answer here.)

    opened by christyjacob4 0
  • update to support 1.0.0-RC1

    update to support 1.0.0-RC1

    What does this PR do?

    (Provide a description of what this PR does.)

    Test Plan

    (Write your test plan here. If you changed any code, please provide us with clear instructions on how you verified your changes work.)

    Related PRs and Issues

    (If this PR is related to any other PR or resolves any issue or related to any issue link all related PR and issues here.)

    Have you read the Contributing Guidelines on issues?

    (Write your answer here.)

    opened by lohanidamodar 0
  • File Download Progress callback🚀 Feature:

    File Download Progress callback🚀 Feature:

    🔖 Feature description

    When we download a file we don't get a progress of how much file is downloaded.

    🎤 Pitch

    Features uses examples: We can use this feature so file sharing kind of apps or some chat app that has a image upload or download feature.

    👀 Have you spent some time to check if this issue has been raised before?

    • [X] I checked and didn't find similar issue

    🏢 Have you read the Code of Conduct?

    enhancement 
    opened by sampatsharma143 2
  • KMP Support ?

    KMP Support ?

    Refactor Current SDK and dependencies like,

    okHttp -> Ktor, GSON -> Kotlinx.serialization

    and add support for more targets which Kotlin can support like JAVA, android, Native, JS and even IOS if you want all from a single codebase, hence maintaining and adding new Features will be easier too,

    and I will love to contribute too...., maybe in near future when I get some time at my hand.

    enhancement 
    opened by Shabinder 6
Releases(1.2.0)
  • 1.2.0(Dec 27, 2022)

    What's Changed

    • Appwrite 1.2.0 support by @Meldiron in https://github.com/appwrite/sdk-for-android/pull/28

    New Contributors

    • @Meldiron made their first contribution in https://github.com/appwrite/sdk-for-android/pull/28

    Full Changelog: https://github.com/appwrite/sdk-for-android/compare/1.1.0...1.2.0

    Source code(tar.gz)
    Source code(zip)
  • 1.1.0(Sep 22, 2022)

    What's Changed

    • Dev by @christyjacob4 in https://github.com/appwrite/sdk-for-android/pull/26

    Full Changelog: https://github.com/appwrite/sdk-for-android/compare/1.0.0...1.1.0

    Source code(tar.gz)
    Source code(zip)
  • 1.0.0(Sep 14, 2022)

    NEW

    • Support for Appwrite 1.0.0
    • More verbose headers have been included in the Clients - x-sdk-name, x-sdk-platform, x-sdk-language, x-sdk-version
    • Helper classes and methods for Permissions, Roles and IDs
    • Helper methods to suport new queries
    • All Dates and times are now returned in the ISO 8601 format

    BREAKING CHANGES

    • databaseId is no longer part of the Database Service constructor. databaseId will be part of the respective methods of the database service.
    • color attribute is no longer supported in the Avatars Service
    • The number argument in phone endpoints have been renamed to phone
    • List endpoints no longer support limit, offset, cursor, cursorDirection, orderAttributes, orderTypes as they have been moved to the queries array
    • read and write permission have been deprecated and they are now included in the permissions array
    • All get prefixed endpoints returning lists have been re-prefixed to list
    • Renamed methods of the Query helper
      1. lesser renamed to lessThan
      2. lesserEqual renamed to lessThanEqual
      3. greater renamed to greaterThan
      4. greaterEqual renamed to greaterThanEqual
    • User response model is now renamed to Account

    Full Changelog for Appwrite 1.0.0 can be found here: https://github.com/appwrite/appwrite/blob/master/CHANGES.md

    Source code(tar.gz)
    Source code(zip)
  • 1.0.0-SNAPSHOT(Sep 6, 2022)

    NEW

    • Support for Appwrite 1.0.0-RC1
    • More verbose headers have been included in the Clients - x-sdk-name, x-sdk-platform, x-sdk-language, x-sdk-version
    • Helper classes and methods for Permissions, Roles and IDs
    • Helper methods to suport new queries
    • All Dates and times are now returned in the ISO 8601 format

    BREAKING CHANGES

    • databaseId is no longer part of the Database Service constructor. databaseId will be part of the respective methods of the database service.
    • color attribute is no longer supported in the Avatars Service
    • The number argument in phone endpoints have been renamed to phone
    • List endpoints no longer support limit, offset, cursor, cursorDirection, orderAttributes, orderTypes as they have been moved to the queries array
    • read and write permission have been deprecated and they are now included in the permissions array
    • Renamed methods of the Query helper
      1. lesser renamed to lessThan
      2. lesserEqual renamed to lessThanEqual
      3. greater renamed to greaterThan
      4. greaterEqual renamed to greaterThanEqual
    • User response model is now renamed to Account

    Full Changelog for Appwrite 1.0.0-RC1 can be found here: https://github.com/appwrite/appwrite/blob/master/CHANGES.md

    Source code(tar.gz)
    Source code(zip)
  • 0.7.0(Jun 28, 2022)

    • Support for Appwrite 0.15
    • NEW Phone authentication account.createPhoneSession()
    • BREAKING Database -> Databases
    • BREAKING account.createSession() -> account.createEmailSession()
    • BREAKING dateCreated attribute removed from Team, Execution, File models
    • BREAKING dateCreated and dateUpdated attribute removed from Func, Deployment, Bucket models
    • BREAKING Realtime channels
      • collections.[COLLECTION_ID] is now databases.[DATABASE_ID].ollections.[COLLECTION_ID]
      • collections.[COLLECTION_ID].documents is now databases.[DATABASE_ID].ollections.[COLLECTION_ID].documents

    Full Changelog for Appwrite 0.15 can be found here: https://github.com/appwrite/appwrite/blob/master/CHANGES.md#version-0150

    Source code(tar.gz)
    Source code(zip)
  • 0.6.1(May 17, 2022)

    What's Changed

    • Dev by @christyjacob4 in https://github.com/appwrite/sdk-for-android/pull/21

    Full Changelog: https://github.com/appwrite/sdk-for-android/compare/0.6.0...0.6.1

    Source code(tar.gz)
    Source code(zip)
  • 0.6.0(May 17, 2022)

    • Support for 0.14.0
    • BREAKING CHANGE Renamed providers to authProviders in Projects
    • BREAKING CHANGE Renamed stdout to response in Execution
    • BREAKING CHANGE Removed delete endpoint from the Accounts API
    • BREAKING CHANGE Renamed name to userName on Membership response model
    • BREAKING CHANGE Renamed event to events on Realtime Response and now is an array of strings
    • Added teamName to Membership response model
    • Added new endpoint to update user's status from the Accounts API

    Full Changelog: https://github.com/appwrite/sdk-for-android/compare/0.5.0...0.6.0

    Source code(tar.gz)
    Source code(zip)
  • 0.5.0(Apr 13, 2022)

    • Add resumable upload support
    • Fix cookies for Android 12+

    Full Changelog: https://github.com/appwrite/sdk-for-android/compare/0.4.0...0.5.0

    Source code(tar.gz)
    Source code(zip)
  • 0.4.0(Mar 3, 2022)

    • Support for Appwrite 0.13
    • BREAKING Tags have been renamed to Deployments
    • BREAKING createFile function expects Bucket ID as the first parameter
    • BREAKING createDeployment and createFile functions expect a file path rather than the file itself
    • BREAKING list<Entity> endpoints now contain a total attribute instead of sum
    • onProgress() callback function for endpoints supporting file uploads
    • Support for synchronous function executions
    • Bug fixes and Improvements

    Full Changelog for Appwrite 0.13 can be found here: https://github.com/appwrite/appwrite/blob/master/CHANGES.md#version-0130

    Source code(tar.gz)
    Source code(zip)
  • 0.4.0-SNAPSHOT(Mar 1, 2022)

  • 0.3.3(Jan 28, 2022)

  • 0.3.2(Jan 25, 2022)

  • 0.3.2-SNAPSHOT(Jan 21, 2022)

  • 0.3.0(Jan 7, 2022)

  • 0.3.0-SNAPSHOT(Nov 25, 2021)

  • 0.2.1(Oct 18, 2021)

  • 0.2.0(Sep 2, 2021)

    Appwrite Android SDK 0.2.0

    Changelog:

    • [BREAKING] Remove io.appwrite.models.Error and replace usages with existing io.appwrite.exceptions.AppwriteException
    • [BREAKING] Rename io.appwrite.BaseService to io.appwrite.Service for cross-SDK consistency
    • [Account] Add createMagicURLSession
    • [Account] Add updateMagicURLSession
    • [Realtime] Add io.appwrite.services.Realtime service
    • [Client] Automatically set a default realtime endpoint when calling setEndpoint
    • [Client] Add setEndpointRealtime
    Source code(tar.gz)
    Source code(zip)
  • 0.2.0-SNAPSHOT(Aug 31, 2021)

  • 0.0.1-SNAPSHOT(Jul 2, 2021)

  • 0.0.1(Jul 2, 2021)

  • 0.0.0-SNAPSHOT(Jun 17, 2021)

Owner
Appwrite
End to end backend server for frontend and mobile developers. 👩‍💻👨‍💻
Appwrite
Sdk-android - SnapOdds Android SDK

Documentation For the full API documentation go to https://snapodds.github.io/sd

Snapodds 0 Jan 30, 2022
Segmenkt - The SegmenKT Kotlin SDK is a Kotlin-first SDK for Segment

SegmenKT Kotlin SDK The SegmenKT Kotlin SDK is a Kotlin-first SDK for Segment. I

UNiDAYS 0 Nov 25, 2022
Frogo SDK - SDK Core for Easy Development

SDK for anything your problem to make easier developing android apps

Frogobox 10 Dec 15, 2022
HubSpot Kotlin SDK 🧺 Implementation of HubSpot API for Java/Kotlin in tiny SDK

HubSpot Kotlin SDK ?? Implementation of HubSpot API for Java/Kotlin in tiny SDK

BOOM 3 Oct 27, 2022
AWS SDK for Android. For more information, see our web site:

AWS SDK for Android For new projects, we recommend interacting with AWS using the Amplify Framework. The AWS SDK for Android is a collection of low-le

AWS Amplify 976 Dec 29, 2022
Countly Product Analytics Android SDK

Countly Android SDK We're hiring: Countly is looking for Android SDK developers, full stack devs, devops and growth hackers (remote work). Click this

Countly Team 648 Dec 23, 2022
Android Real Time Chat & Messaging SDK

Android Chat SDK Overview Applozic brings real-time engagement with chat, video, and voice to your web, mobile, and conversational apps. We power emer

Applozic 659 May 14, 2022
Evernote SDK for Android

Evernote SDK for Android version 2.0.0-RC4 Evernote API version 1.25 Overview This SDK wraps the Evernote Cloud API and provides OAuth authentication

Evernote 424 Dec 9, 2022
Air Native Extension (iOS and Android) for the Facebook mobile SDK

Air Native Extension for Facebook (iOS + Android) This is an AIR Native Extension for the Facebook SDK on iOS and Android. It has been developed by Fr

Freshplanet 219 Nov 25, 2022
Android Chat SDK built on Firebase

Chat21 is the core of the open source live chat platform Tiledesk.com. Chat21 SDK Documentation Features With Chat21 Android SDK you can: Send a direc

Chat21 235 Dec 2, 2022
Liquid SDK (Android)

Liquid Android SDK Quick Start to Liquid SDK for Android This document is just a quick start introduction to Liquid SDK for Android. We recommend you

Liquid 17 Nov 12, 2021
AWS SDK for Android. For more information, see our web site:

AWS SDK for Android For new projects, we recommend interacting with AWS using the Amplify Framework. The AWS SDK for Android is a collection of low-le

AWS Amplify 975 Dec 24, 2022
新浪微博 Android SDK

ReadMe 公告: 鉴于线上服务器出现问题,推荐下载本地aar后上传到自己公司的服务器,保证后续服务稳定, 我们也将尽快重新提供一个稳定的地址供大家使用。 新包地址:https://github.com/sinaweibosdk/weibo_android_sdk/tree/master/2019

SinaWeiboSDK 1.8k Dec 30, 2022
This App is sending Face capture data over network, built around the latest Android Arcore SDK.

AndroidArcoreFacesStreaming From any Android phone ArCore compatible, using this app will send over TCP 5680 bytes messages: The first 5616 bytes is a

Maxime Dupart 30 Nov 16, 2022
Trackingplan for Android SDK

With Trackingplan for Android you can make sure that your tracking is going as you planned without changing your current analytics stack or code.

Trackingplan 3 Oct 26, 2021
Desk360 Mobile Chat SDK for Android

Desk360 Chat Android SDK Introduction Desk360 Live Chat SDK is an open source Android library that provides live support to your customers directly fr

null 31 Dec 13, 2022
Storyblok Kotlin Multiplatform SDK sample (Android, JVM, JS)

storyblok-mp-SDK-sample *WIP* ... a showcase of the Storyblok Kotlin Multiplatform Client SDK. (Android, JVM, JS, iOS, ...) What's included ?? • About

Mike Penz 6 Jan 8, 2022
A demo of Rongcloud uniapp sdk integration for compiling debug-apk in Android Studio

Rongcloud-uniapp-sdk-demo A demo of Rongcloud uniapp sdk integration for compiling debug-apk in Android Studio 这是一个为了给uniapp在Android平台打出debug-apk的demo

Zongkui Guo 1 Oct 13, 2021
StreamPack: live streaming SDK for Android based on Secure Reliable Transport

StreamPack: live streaming SDK for Android based on Secure Reliable Transport (SRT) StreamPack brings the best audio/video live technologies together

guo shao hong 2 Aug 10, 2022