Delete all the accounts created by one application

This code snippet deletes all the accounts registered on a device basing on the 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

static void delete_all_accounts_by_package(const char *package_name)
{
	//Connecting to account db
	if (account_connect() == ACCOUNT_ERROR_NONE)
	{
		//Deleting an account
		if (account_delete_from_db_by_package_name(package_name) == ACCOUNT_ERROR_NONE)
		{
			dlog_print(DLOG_INFO, LOG_TAG, "All accounts created by %s deleted!", package_name);
		}
		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!");
	}
}

Responses

0 Replies