- listener
- The listener to send notifications to
- handler
- Android.OS.Handler identifying the thread to use for notifications, null for the main thread
- updateImmediately
- If true, the listener will be invoked (on the handler thread) right away with the current account list
Type Reason Java.Lang.IllegalArgumentException if listener is null Java.Lang.IllegalStateException if listener was already added
Adds an Android.Accounts.IOnAccountsUpdateListener to this instance of the Android.Accounts.AccountManager. This listener will be notified whenever the list of accounts on the device changes.
As long as this listener is present, the AccountManager instance will not be garbage-collected, and neither will the Android.Content.Context used to retrieve it, which may be a large Activity instance. To avoid memory leaks, you must remove this listener before then. Normally listeners are added in an Activity or Service's Android.App.Activity.OnCreate(Android.OS.Bundle) and removed in Android.App.Activity.OnDestroy.
It is safe to call this method from the main thread.
This method requires the caller to hold the permission NoType:android/Manifest$permission;Href=../../../reference/android/Manifest.permission.html#GET_ACCOUNTS.