Skip to content

Instantly share code, notes, and snippets.

@oradkovsky
Created March 9, 2020 15:18
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save oradkovsky/ecc7d3a5fa8fda0e6a3afbd5350bed05 to your computer and use it in GitHub Desktop.
Save oradkovsky/ecc7d3a5fa8fda0e6a3afbd5350bed05 to your computer and use it in GitHub Desktop.
val credential = GoogleAccountCredential.usingOAuth2(
applicationContext, listOf(GmailScopes.GMAIL_READONLY)
)
.setBackOff(ExponentialBackOff())
.setSelectedAccount(
Account(
FirebaseAuth.getInstance().currentUser?.email,
BuildConfig.APPLICATION_ID
)
)
val service = Gmail.Builder(
NetHttpTransport(), AndroidJsonFactory.getDefaultInstance(), credential
)
.setApplicationName("YourAppName")
.build()
GlobalScope.launch {
//do the reading
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment