
are you using the android SDK? If so, this is done automatically.
See https://appwrite.io/docs/advanced/security/authentication#persistence

i use android web application

from appwrite lib

sorry i don't understand

a moment

its not sdk?
account.createOAuth2Session(
activity = context as ComponentActivity,
provider = OAuthProvider.YANDEX,
)

what package did you install?

implementation("io.appwrite:sdk-for-android:6.1.0")```

right that's the android sdk

so it's done automatically

so what you should do is:
- app start
- call account.get()
- if successful, proceed to authenticated screen
- if unsuccessful, redirect to login page

is it possible for me to just save the session and write it to SharedPreferences and then?

i do not recomment this. you end up with a weird source of truth

What would be better?

so what you should do is:
- app start
- call account.get()
- if successful, proceed to authenticated screen
- if unsuccessful, redirect to login page

if(account.get()){
}else{
}

right?

try/catch

account.get() will throw an exception on error

i get it

so it won't be stored in the SharePreference right?

the session cookie is stored in shared preferences automatically: https://github.com/appwrite/sdk-for-android/blob/main/library/src/main/java/io/appwrite/cookies/stores/SharedPreferencesCookieStore.kt

thx

i get it

thank you so much
Recommended threads
- 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...
- Realtime didn't work in react native exp...
``` useEffect(() => { const { client } = createClient(); const unsubscribe = client.subscribe(`databases.${process.env.EXPO_PUBLIC_APPWRITE_DATABASE}.t...
