Documentation for maplib/Account.kt

class Account

Class for NextGIS Account operations. It’s expected that application authorised in nextgis.com and has initial access and update tokens. After created account class instance the tokens will updated internally. The latest values can be fetched using options function.

constructor(clientId String,  accessToken String,  updateToken String, authorizeFailedCallback (() -> Unit)? )

Main constructor

Parameters
  • clientId – d Application identifier

  • accessToken – n oAuth2 access token

  • updateToken – n oAuth2 refresh token

  • authorizeFailedCallback – k Callback function. Executes if update token failed. In such case account change state to unauthorized. May be null.

val firstName : String

User first name.

val lastName : String

User last name.

val email : String

User e-mail.

val avatar : Bitmap

User avatar.

val authorized : Boolean

Return if account is authorised or not.

val supported : Boolean

Return if user supported or not.

fun exit()

Exit from account. Authorize property became false.

fun options() : Map<String, String> = auth.options()

Get account options. Now return only authorize status (latest access token, update token etc.).

Returns

key-value dictionary of options.

fun isFunctionAvailable(application: String, function: String) : Boolean = API.accountIsFuncAvailableInt(application, function)

Check if function indicated by application name and function name is available to this account.

Parameters
  • application – Application name.

  • function – Function name.

Returns

True if function available or false.

fun updateInfo() : Boolean = API.accountUpdateInt()

Update user information in account class. Method is synchronous and must be started from separate thread.

Returns

True on success.

fun updateSupportInfo() : Boolean = API.accountUpdateSupportInt()

Update user support information in account class. Method is synchronous and must be started from separate thread.

Returns

True on success.