7

I am developing a project which needs to remotely delete the accounts and sync such as Facebook, Twitter, Dropbox and so forth... Is this possible to be done through programming? Need opinions from you guys...

Thanks.

4

1 に答える 1

14

AccountManagerはい、とremoveAccountメソッドを使用して実行できます。

まず、:のインスタンスを取得しAccountManagerます

AccountManager am = AccountManager.get(this);

次に、デバイス上のすべてのアカウントのリストを取得します。

Account[] accounts = am.getAccounts();

削除するアカウントを選択したら(この例では最初のアカウントを使用します)、次のアカウントを呼び出しremoveAccountます。

if (accounts.length > 0) {
    Account accountToRemove = accounts[0];
    am.removeAccount(accountToRemove, null, null);
}

メソッドの2番目のパラメーターを使用してremoveAccount、アカウントが削除されたときに呼び出されるコールバックを提供できます(アカウントの削除は非同期操作です)。

于 2012-09-25T15:40:40.033 に答える