Created
March 9, 2020 15:18
-
-
Save oradkovsky/ecc7d3a5fa8fda0e6a3afbd5350bed05 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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