Delete an account
This code snippet deletes the account registered on a device basing on the user name of the account, and package name of the app that created an account. PRIVILEGES NEEDED to be set in tizen-manifest.xml file: http://tizen.org/privilege/account.read http://tizen.org/privilege/account.write
// PRIVILEGES NEEDED to be set in tizen-manifest.xml file:
// http://tizen.org/privilege/account.read
// http://tizen.org/privilege/account.write
#include <stdlib.h>
#include <account.h>
#include <dlog.h> //for logging purposes
static void delete_an_account()
{
//Connecting to account db
if (account_connect() == ACCOUNT_ERROR_NONE)
{
//Deleting an account
if (account_delete_from_db_by_user_name("INSERT_USER_NAME_HERE", "INSERT_PACKAGE_NAME_HERE") == ACCOUNT_ERROR_NONE)
{
dlog_print(DLOG_INFO, LOG_TAG, "Account deleted!");
}
else
{
dlog_print(DLOG_ERROR, LOG_TAG, "Cannot delete an account!");
}
}
if (account_disconnect() != ACCOUNT_ERROR_NONE)
{
dlog_print(DLOG_ERROR, LOG_TAG, "Cannot disconnect from account DB!");
}
}