[CLOSED] How do I maintain only one instance of the client and reuse it across my app?
- 0
- Android
- Accounts

I am creating an Android application using Android studio. Programming language Java.

This isn't really an appwrite specific thing...perhaps you can create a singleton or a global object or attach the client to the Application. I don't know much about android development, though

I can create a singleton but the client requires context that's why I am confused.

late initialization, then?

That is to say I should create only client instance the initialise it whenever I need it in activity

im not sure if java has late initialization like other languages: https://github.com/appwrite/demo-almost-netflix-for-android/blob/c37afc1a49873ab42753d80ce3ca91bdfe515567/app/src/main/java/io/appwrite/almostnetflix/core/Configuration.kt#L9

Thanks that was helpful.

[CLOSED] How do I maintain only one instance of the client and reuse it across my app?
Recommended threads
- Adding "name" column to table creates 2-...
As stated, im adding the "name" column to one table, it adds 4 duplicates. In another table it adds 3 duplicates, and when I delete 1 of them, all duplucates di...
- Google signin with appwrite
I want to use Google sign in in android and create session from idToken using appwrite. But, i don't know if it's achievable or not. because i don't want to use...
- Realtime didn't work in react native exp...
``` useEffect(() => { const { client } = createClient(); const unsubscribe = client.subscribe(`databases.${process.env.EXPO_PUBLIC_APPWRITE_DATABASE}.t...
