I have been following this guide in making an AccountManager
for Android. But I am using Xamarin, and I have reached a point where the C# code is too different from the Java code. The account is on the phone, and I can add an account from the settings screen just fine. But when I try to access the AccountManager.AddAccount
method externally, the arguments it takes are different and I do not think they are explained very well in the Xamarin documentation.
This page in the Xamarin documentation shows that the last two arguments in AddAccount
are IAccountManagerCallback
and Handler
parameters. I am not sure how to go about implementing these in a way that I can pass them into AddAccount
.
Just to be clear, what I want to do is call AddAccount
(which is inside my custom AbstractAccountAuthenticator
) from a different activity. When you click "Add Account" in the Android settings screen, it automatically calls the right function.
I see this was posted a while back but in case it is still of some help to someone this is how I implemented IAccountManagerCallback in Xamarin...