Well, the whole Android account authentication and synchronization mechanism can be quite complicated at a glance, and the GitHub app for Android adds another level of complexity, but I will try to explain the whole stream to you (I hope that my understanding is correct).
First, I recommend this article about Android Authenticator if you are not already familiar with the subject. GitHub Android uses exactly the same mechanism described in this article.
You are right, HomeActivity starts HomeActivity . He then starts OrganizationLoader to load the list of orgs. This loader calls a method from OrganizationService , which is part of the Java GitHub API . GitHub Android uses RoboGuice to configure the injection of the most commonly used classes, such as the GitHub API services. You can see that the OrganizationService is created in the ServicesModule . A constructor parameter requires GithubClient , as well as a GitHubModule , which is configured to return an AccountClient when an instance of GithubClient . AccountClient overrides the configureRequest() method and calls
String token = account.getAuthToken();
This is a method of the GitHubAccount class that calls a method from the internal Android AccountManager . And the AccountManager configured to use this AccountAuthenticator , which you mentioned, which returns the LoginActivity intention if the device does not have an account.
Hope this helps :)
source share