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
<receiver android:name=".SmsBroadcastReceiver" android:exported="true"> | |
<intent-filter> | |
<action android:name="com.google.android.gms.auth.api.phone.SMS_RETRIEVED"/> | |
</intent-filter> | |
</receiver> |
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 SmsBroadcastReceiver : BroadcastReceiver() { | |
override fun onReceive(context: Context?, intent: Intent?) { | |
if (SmsRetriever.SMS_RETRIEVED_ACTION == intent?.action) { | |
val bundle = intent.extras | |
val status = bundle?.get(SmsRetriever.EXTRA_STATUS) as Status | |
when (status.statusCode) { | |
CommonStatusCodes.SUCCESS -> { |
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 client: SmsRetrieverClient = SmsRetriever.getClient(this) | |
val task = client.startSmsRetriever() | |
task.addOnSuccessListener { | |
// Successfully started retriever, expect broadcast intent | |
} | |
task.addOnFailureListener { | |
// Failed to start retriever, inspect Exception for more details |
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
/* Module level build.gradle */ | |
android { | |
defaultConfig { | |
... | |
flavorDimensions "default" | |
} | |
signingConfigs { |
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
import java.nio.file.Paths | |
/* | |
* Automates generation of Release APK | |
* ./gradlew assembleRelease | |
* */ | |
Properties props = new Properties() | |
def userHome = Paths.get(System.getProperty('user.home')); | |
def propFile = file(userHome.resolve('PATH_TO_SIGNING_CONFIG_PROPERTIES_FILE.properties')) | |
if (propFile.canRead()) { |