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
private fun signIn() { | |
val signInIntent = googleSignInClient.signInIntent | |
startActivityForResult(signInIntent, RC_SIGN_IN) | |
} |
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
// Configure Google Sign In | |
val gso = GoogleSignInOptions.Builder(GoogleSignInOptions.DEFAULT_SIGN_IN) | |
.requestIdToken(getString(R.string.default_web_client_id)) | |
.requestEmail() | |
.build() | |
//Initialize google sign in client | |
googleSignInClient = GoogleSignIn.getClient(requireActivity(), gso) |
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
<com.google.android.gms.common.SignInButton | |
android:id="@+id/sign_in_button" | |
android:layout_width="match_parent" | |
android:layout_height="wrap_content" | |
tools:layout_editor_absoluteY="277dp" | |
tools:layout_editor_absoluteX="61dp" /> |
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
implementation 'com.google.firebase:firebase-auth:19.3.0' | |
implementation 'com.google.android.gms:play-services-auth:17.0.0' |
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
public override fun onActivityResult(requestCode: Int, resultCode: Int, data: Intent?) { | |
super.onActivityResult(requestCode, resultCode, data) | |
// Result returned from launching the Intent from GoogleSignInApi.getSignInIntent(...); | |
if (requestCode == RC_SIGN_IN) { | |
val task = GoogleSignIn.getSignedInAccountFromIntent(data) | |
try { | |
// Google Sign In was successful, authenticate with Firebase | |
val account = task.getResult(ApiException::class.java) | |
firebaseAuthWithGoogle(account!!) |
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
class MyStreamListener(tweepy.StreamListener): | |
def __init__(self, api=None): | |
super(MyStreamListener, self).__init__() | |
self.num_tweets = 0 | |
self.file = open("tweets.txt", "w") | |
def on_status(self, status): | |
tweet = status._json | |
self.file.write( json.dumps(tweet) + '\n' ) | |
self.num_tweets += 1 |