now i've changed implementation as i came to know that we can access
accounts using AccountManager
Therefore i'm using this code: but this is also not giving any output
not even exception.
AccountManager accountManager =
(AccountManager)mContext.getSystemService(Context.ACCOUNT_SERVICE);
android.accounts.Account[] accounts =
AccountManager.get(mContext).getAccounts();
for (android.accounts.Account account: accounts) {
AccountManager.get(mContext).removeAccount(account, null,
null);
}
It would be great help if u can suggest something on this.
On Jul 30, 2:18 am, RichardC <[email protected]> wrote:
> In the file you linked above the class AccountManagerService is marked
> as @hide in the java doc - that means it's an internal class.
>
> Also there is no reference to AccountManagerService on the
> developer.android.com.
>
> Either of these should indicate to you that what you are trying to do
> is unsupported.
>
> On Jul 29, 10:03 pm, Nick Richardson <[email protected]>
> wrote:
>
>
>
> > Usually a good place to start is to find out what's causing it to crash.
> > Use logcat and look for "caused by" in the exception.
>
> > My money's on a NullPointerException.
>
> > On Tue, Jul 27, 2010 at 9:24 PM, parul <[email protected]> wrote:
> > > Please help me how to delete google accounts from "accounts and sync".
> > > I'm trying to call this code in my app:
>
> > > AccountManagerService ams = new AccountManagerService(mContext);
> > > ams.onServiceChanged(null,true);
>
> > > Its crashing at object creation. If anybody is aware of any other way
> > > to delete account plz let me know.
>
> > > ==============================================================
> > > onServiceChanged() method is defined in AccountManagerService.java.
> > > AccountManagerService.java (frameworks\base\core\java\android
> > > \accounts)
>
> > > public void onServiceChanged(AuthenticatorDescription desc, boolean
> > > removed) {
> > > boolean accountDeleted = false;
> > > SQLiteDatabase db = mOpenHelper.getWritableDatabase();
> > > Cursor cursor = db.query(TABLE_ACCOUNTS,
> > > new String[]{ACCOUNTS_ID, ACCOUNTS_TYPE, ACCOUNTS_NAME},
> > > ACCOUNTS_TYPE + "=?", new String[]{desc.type}, null, null,
> > > null);
> > > try {
> > > while (cursor.moveToNext()) {
> > > final long accountId = cursor.getLong(0);
> > > final String accountType = cursor.getString(1);
> > > final String accountName = cursor.getString(2);
> > > Log.d(TAG, "deleting account " + accountName + " because
> > > type "
> > > + accountType + " no longer has a registered
> > > authenticator");
> > > db.delete(TABLE_ACCOUNTS, ACCOUNTS_ID + "=" + accountId,
> > > null);
> > > accountDeleted = true;
> > > }
> > > } finally {
> > > cursor.close();
> > > if (accountDeleted) {
> > > sendAccountsChangedBroadcast();
> > > }
> > > }
> > > ========================================================================
>
> > > --
> > > You received this message because you are subscribed to the Google
> > > Groups "Android Beginners" group.
>
> > > NEW! Try asking and tagging your question on Stack Overflow at
> > >http://stackoverflow.com/questions/tagged/android
>
> > > To unsubscribe from this group, send email to
> > > [email protected]<android-beginners%2bunsubscr[email protected]>
> > > For more options, visit this group at
> > >http://groups.google.com/group/android-beginners?hl=en
>
> > --
> > //Nick Richardson
> > //[email protected] Hide quoted text -
>
> - Show quoted text -
--
You received this message because you are subscribed to the Google
Groups "Android Beginners" group.
ATTENTION: Android-Beginners will be permanently disabled on August 9 2010. For
more information about this change, please read [http://goo.gl/xkfl] or visit
the Group home page.
Try asking and tagging your question on Stack Overflow at
http://stackoverflow.com/questions/tagged/android
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-beginners?hl=en