Class AccountService
Definition
- Namespace:
- Tizen.Account.AccountManager
- Assembly:
- Tizen.Account.AccountManager.dll
The AccountManager APIs are separated into two major sections:
- Registering an account provider while an application is installed. This information will be used for the Add account screen.
- Adding an account information when an application signs in successfully to share the account information to the Tizen system. This information will be shown in the Tizen settings account menu.
The APIs of both of the sections consist of the following functionality:
- Create an account or account provider.
- Update an account or account provider (Only available for the creator).
- Delete an account or account provider (Only available for the creator).
- Read an account or account provider with some filter.
C#Copypublic static class AccountService
- Inheritance
-
objectAccountService
Fields
Declaration
C#Copypublic static readonly string CalendarCapability
Field Value
| Type | Description |
|---|---|
| string |
Declaration
C#Copypublic static readonly string ContactCapability
Field Value
| Type | Description |
|---|---|
| string |
Declaration
C#Copypublic static readonly string DocumentCapability
Field Value
| Type | Description |
|---|---|
| string |
Declaration
C#Copypublic static readonly string EmailCapability
Field Value
| Type | Description |
|---|---|
| string |
Declaration
C#Copypublic static readonly string GameCapability
Field Value
| Type | Description |
|---|---|
| string |
Declaration
C#Copypublic static readonly string MessageCapability
Field Value
| Type | Description |
|---|---|
| string |
Declaration
C#Copypublic static readonly string MusicCapability
Field Value
| Type | Description |
|---|---|
| string |
Declaration
C#Copypublic static readonly string PhotoCapability
Field Value
| Type | Description |
|---|---|
| string |
Declaration
C#Copypublic static readonly string VideoCapability
Field Value
| Type | Description |
|---|---|
| string |
Methods
Declaration
C#Copypublic static int AddAccount(Account account)
Parameters
| Type | Name | Description |
|---|---|---|
| Account | account | New Account instance to be added. |
Returns
| Type | Description |
|---|---|
| int | The account ID of the account instance. |
Exceptions
| Type | Condition |
|---|---|
| System.InvalidOperationException | In case of any DB error. |
| System.ArgumentException | In case of an invalid parameter. |
| System.UnauthorizedAccessException | In case of privilege not defined. |
| System.OutOfMemoryException | In case of OutOfMemory error. |
| System.NotSupportedException | The required feature is not supported. |
DeleteAccount(string, string)
Deletes the account from the account database by user name.
Declaration
C#Copypublic static void DeleteAccount(string userName, string packageName)
Parameters
| Type | Name | Description |
|---|---|---|
| string | userName | The user name of the account to delete. |
| string | packageName | The package name of the account to delete. |
Exceptions
| Type | Condition |
|---|---|
| System.InvalidOperationException | In case of any DB error. |
| System.ArgumentException | In case of an invalid parameter. |
| System.UnauthorizedAccessException | In case of privilege not defined. |
| System.NotSupportedException | The required feature is not supported. |
Declaration
C#Copypublic static void DeleteAccount(string packageName)
Parameters
| Type | Name | Description |
|---|---|---|
| string | packageName | The package name of the account to delete. |
Exceptions
| Type | Condition |
|---|---|
| System.InvalidOperationException | In case of any DB error. |
| System.ArgumentException | In case of an invalid parameter. |
| System.UnauthorizedAccessException | In case of privilege not defined. |
| System.NotSupportedException | The required feature is not supported. |
Declaration
C#Copypublic static void DeleteAccount(Account account)
Parameters
| Type | Name | Description |
|---|---|---|
| Account | account | Account instance to be deleted from the database. |
Exceptions
| Type | Condition |
|---|---|
| System.InvalidOperationException | In case of any DB error. |
| System.ArgumentException | In case of an invalid parameter. |
| System.UnauthorizedAccessException | In case of privilege not defined. |
| System.NotSupportedException | The required feature is not supported. |
Declaration
C#Copypublic static Account GetAccountById(int accountId)
Parameters
| Type | Name | Description |
|---|---|---|
| int | accountId | The account ID to be searched. |
Returns
| Type | Description |
|---|---|
| Account | Account instance with reference to the given ID. |
Exceptions
| Type | Condition |
|---|---|
| System.InvalidOperationException | In case of any DB error or record not found for given account ID. |
| System.ArgumentException | In case of an invalid parameter. |
| System.UnauthorizedAccessException | In case of privilege not defined. |
| System.NotSupportedException | The required feature is not supported. |
GetAccountProviderByAppId(string)
Retrieves the account provider information with the application ID.
Declaration
C#Copypublic static AccountProvider GetAccountProviderByAppId(string appId)
Parameters
| Type | Name | Description |
|---|---|---|
| string | appId | The application ID. |
Returns
| Type | Description |
|---|---|
| AccountProvider | The AccountProvider instance associated with the given application ID. |
Exceptions
| Type | Condition |
|---|---|
| System.InvalidOperationException | In case of any DB error or record not found for given appId. |
| System.ArgumentException | In case of an invalid parameter. |
| System.UnauthorizedAccessException | In case of privilege not defined. |
| System.NotSupportedException | The required feature is not supported. |
GetAccountProviders()
Retrieves all the AccountProviders details from the account database.
Declaration
C#Copypublic static IEnumerable<AccountProvider> GetAccountProviders()
Returns
| Type | Description |
|---|---|
| System.Collections.Generic.IEnumerable<T><AccountProvider> | List of AccountProviders. |
Exceptions
| Type | Condition |
|---|---|
| System.InvalidOperationException | In case of any DB error. |
| System.UnauthorizedAccessException | In case of privilege not defined. |
| System.NotSupportedException | The required feature is not supported. |
GetAccountProvidersByFeature(string)
Retrieves all the account providers information with feature.
Declaration
C#Copypublic static IEnumerable<AccountProvider> GetAccountProvidersByFeature(string feature)
Parameters
| Type | Name | Description |
|---|---|---|
| string | feature | The capability value to search for account providers. |
Returns
| Type | Description |
|---|---|
| System.Collections.Generic.IEnumerable<T><AccountProvider> | Retrieves the AccountProviders information with the capability name. |
Exceptions
| Type | Condition |
|---|---|
| System.InvalidOperationException | In case of any DB error or record not found for given feature. |
| System.ArgumentException | In case of invalid parameter. |
| System.UnauthorizedAccessException | In case of privilege not defined. |
| System.NotSupportedException | The required feature is not supported. |
Declaration
C#Copypublic static IEnumerable<Account> GetAccountsAsync()
Returns
| Type | Description |
|---|---|
| System.Collections.Generic.IEnumerable<T><Account> | List of accounts. |
Exceptions
| Type | Condition |
|---|---|
| System.InvalidOperationException | In case of any DB error. |
| System.UnauthorizedAccessException | In case of privilege not defined. |
| System.NotSupportedException | The required feature is not supported. |
GetAccountsByCapabilityType(string)
Retrieves all accounts with the given capability type.
Declaration
C#Copypublic static IEnumerable<Account> GetAccountsByCapabilityType(string type)
Parameters
| Type | Name | Description |
|---|---|---|
| string | type | Capability type. |
Returns
| Type | Description |
|---|---|
| System.Collections.Generic.IEnumerable<T><Account> | Accounts list matched with the capability type. |
Exceptions
| Type | Condition |
|---|---|
| System.InvalidOperationException | In case of any DB error or record not found for the given capability type. |
| System.ArgumentException | In case of an invalid parameter. |
| System.UnauthorizedAccessException | In case of privilege not defined. |
| System.NotSupportedException | The required feature is not supported. |
GetAccountsByPackageName(string)
Retrieves all the accounts with the given package name.
Declaration
C#Copypublic static IEnumerable<Account> GetAccountsByPackageName(string packageName)
Parameters
| Type | Name | Description |
|---|---|---|
| string | packageName | The package name to search. |
Returns
| Type | Description |
|---|---|
| System.Collections.Generic.IEnumerable<T><Account> | Accounts list matched with the package name. |
Exceptions
| Type | Condition |
|---|---|
| System.InvalidOperationException | In case of any DB error or record not found for given package name. |
| System.ArgumentException | In case of an invalid parameter. |
| System.UnauthorizedAccessException | In case of privilege not defined. |
| System.NotSupportedException | The required feature is not supported. |
Declaration
C#Copypublic static IEnumerable<Account> GetAccountsByUserName(string userName)
Parameters
| Type | Name | Description |
|---|---|---|
| string | userName | The user name to search. |
Returns
| Type | Description |
|---|---|
| System.Collections.Generic.IEnumerable<T><Account> | Accounts list matched with the user name. |
Exceptions
| Type | Condition |
|---|---|
| System.InvalidOperationException | In case of any DB error or record not found for given username. |
| System.ArgumentException | In case of an invalid parameter. |
| System.UnauthorizedAccessException | In case of privilege not defined. |
| System.NotSupportedException | The required feature is not supported. |
Declaration
C#Copypublic static int GetAccountsCount()
Returns
| Type | Description |
|---|---|
| int | The number of accounts in the database. |
Exceptions
| Type | Condition |
|---|---|
| System.InvalidOperationException | In case of any DB error. |
| System.UnauthorizedAccessException | In case of privilege not defined. |
| System.NotSupportedException | The required feature is not supported. |
Declaration
C#Copypublic static Dictionary<string, CapabilityState> GetCapabilitiesById(int accountId)
Parameters
| Type | Name | Description |
|---|---|---|
| int | accountId | Account instance. |
Returns
| Type | Description |
|---|---|
| System.Collections.Generic.Dictionary<TKey, TValue><string, CapabilityState> | Capabilities list as dictionary of the capability type and state. |
Exceptions
| Type | Condition |
|---|---|
| System.InvalidOperationException | In case of any DB error or record not found for given account ID. |
| System.ArgumentException | In case of an invalid parameter. |
| System.UnauthorizedAccessException | In case of privilege not defined. |
| System.NotSupportedException | The required feature is not supported. |
Declaration
C#Copypublic static void UpdateAccount(Account account)
Parameters
| Type | Name | Description |
|---|---|---|
| Account | account | Account instance to be updated. |
Exceptions
| Type | Condition |
|---|---|
| System.InvalidOperationException | In case of any DB error. |
| System.ArgumentException | In case of an invalid parameter. |
| System.UnauthorizedAccessException | In case of privilege not defined. |
| System.OutOfMemoryException | In case of OutOfMemory error. |
| System.NotSupportedException | The required feature is not supported. |
UpdateSyncStatusById(Account, AccountSyncState)
Updates the sync status of the given account.
Declaration
C#Copypublic static void UpdateSyncStatusById(Account account, AccountSyncState status)
Parameters
| Type | Name | Description |
|---|---|---|
| Account | account | Account for which the sync status needs to be updated. |
| AccountSyncState | status | Sync State |
Exceptions
| Type | Condition |
|---|---|
| System.InvalidOperationException | In case of any DB error. |
| System.ArgumentException | In case of an invalid parameter. |
| System.UnauthorizedAccessException | In case of privilege not defined. |
| System.NotSupportedException | The required feature is not supported. |
Events
AccountUpdated
ContentUpdated event is triggered when the media item info from DB changes.
Declaration
C#Copypublic static event EventHandler<AccountSubscriberEventArgs> AccountUpdated
Event Type
| Type | Description |
|---|---|
| System.EventHandler<TEventArgs><AccountSubscriberEventArgs> |
Remarks
ContentUpdate event is triggered if the MediaInformation updated/deleted or new information is inserted.
Exceptions
| Type | Condition |
|---|---|
| System.InvalidOperationException | In case of any DB error. |
| System.ArgumentException | In case of an invalid parameter. |
| System.UnauthorizedAccessException | In case of privilege not defined. |
| System.NotSupportedException | The required feature is not supported. |