Skip to content

Commit

Permalink
Merge pull request #17 from mntechnique/develop
Browse files Browse the repository at this point in the history
[Fix] OTP Catcher
  • Loading branch information
revant authored Jan 7, 2018
2 parents 6219b1e + c22fcf7 commit 8bebb6c
Showing 1 changed file with 7 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,11 @@ class SMSBroadcastReceiver : BroadcastReceiver() {
var bundle = intent.extras
if (bundle != null) {

var pdus:Array<Object> = bundle.get("pdus") as Array<Object>
var pdus:Array<Any> = bundle.get("pdus") as Array<Any>

for (i in 0..pdus.size -1) {
var message:SmsMessage? = null
var message:SmsMessage? = SmsMessage.createFromPdu(pdus[i] as ByteArray)

when(context.telephonyManager.phoneType) {
TelephonyManager.PHONE_TYPE_GSM -> {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
Expand All @@ -39,11 +40,11 @@ class SMSBroadcastReceiver : BroadcastReceiver() {
}
}

var senderNum = message?.displayOriginatingAddress
var messageBody = message?.displayMessageBody
var senderNum = message?.originatingAddress
var messageBody = message?.messageBody

Log.d("Number", message?.originatingAddress)
Log.d("SMS", message?.messageBody)
Log.d("Number", senderNum)
Log.d("SMS", messageBody)

var smsIntent = Intent("otp")
smsIntent.putExtra("message", messageBody)
Expand Down

0 comments on commit 8bebb6c

Please sign in to comment.