Last active
April 18, 2017 20:51
-
-
Save kmerrell42/99d0f62a2700b1e9260dc9f115300eed to your computer and use it in GitHub Desktop.
Create a BroadcastReceiver that accepts a callback to let us know the verification code has been received
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 class SmsBroadcastReceiver extends BroadcastReceiver { | |
private final OnVerificationCodeReceivedListener codeReceivedListener; | |
public SmsBroadcastReceiver(@NonNull OnVerificationCodeReceivedListener codeReceivedListener) { | |
this.codeReceivedListener = codeReceivedListener; | |
} | |
@Override | |
public void onReceive(Context context, Intent intent) { | |
// TODO: See if this message is coming from the expected phone number | |
// TODO: If so, parse the code out of the message and notify the callback | |
} | |
interface OnVerificationCodeReceivedListener { | |
void onVerificationCodeReceived(String code); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment