SMS verification with Android SmsRetrieverClient not parsing message
.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty{ height:90px;width:728px;box-sizing:border-box;
}
Tried to implement SMS auto-reading for verification following the steps here:
https://developers.google.com/identity/sms-retriever/request
1) declared
lateinit var smsRetrieverClient: SmsRetrieverClient
private lateinit var smsReceiver: SmsBrReceiver
2) Initialised and registered them in login Activity onCreate
smsRetrieverClient = SmsRetriever.getClient(this)
smsReceiver = SmsBrReceiver()
val intentFilter = IntentFilter()
intentFilter.addAction(SmsRetriever.SMS_RETRIEVED_ACTION)
applicationContext.registerReceiver(smsReceiver, intentFilter)
val task = smsRetrieverClient.startSmsRetriever()
task.addOnSuccessListener(OnSuccessListener<Void> {
smsReceiver.setTimeout()
})
task.addOnFailureListener(OnFailureListener { e ->
showCodeInput()
})
3) Made BroadcastReceiver for SmsRetriever
inner class SmsBrReceiver : BroadcastReceiver() {
var h = Handler()
var r: Runnable = Runnable { doTimeout() }
fun setTimeout() {
h.postDelayed(r, 600000)
}
override fun onReceive(context: Context, intent: Intent?) {
val action = intent.action
if (SmsRetriever.SMS_RETRIEVED_ACTION == action) {
cancelTimeout()
val extras = intent.extras
val status = extras!!.get(SmsRetriever.EXTRA_STATUS) as Status
when (status.statusCode) {
CommonStatusCodes.SUCCESS -> { // not called
4) The SMS comes in format
u200bu200bPlease enter code: 1111 /appKeyXf56
And the app key at the end of SMS matches what the installed app signing key gives for generation as described here:
https://developers.google.com/identity/sms-retriever/verify#computing_your_apps_hash_string
CommonStatusCodes.SUCCESS does not get called after SMS is received, but CommonStatusCodes.TIMEOUT does get called after 5 minutes.
What is missing? Just in case gradle declarations for phone auth are:
com.google.android.gms:play-services-auth-api-phone:16.0.0
classpath "com.google.gms:google-services:4.2.0
android kotlin google-play-services sms-verification
add a comment |
Tried to implement SMS auto-reading for verification following the steps here:
https://developers.google.com/identity/sms-retriever/request
1) declared
lateinit var smsRetrieverClient: SmsRetrieverClient
private lateinit var smsReceiver: SmsBrReceiver
2) Initialised and registered them in login Activity onCreate
smsRetrieverClient = SmsRetriever.getClient(this)
smsReceiver = SmsBrReceiver()
val intentFilter = IntentFilter()
intentFilter.addAction(SmsRetriever.SMS_RETRIEVED_ACTION)
applicationContext.registerReceiver(smsReceiver, intentFilter)
val task = smsRetrieverClient.startSmsRetriever()
task.addOnSuccessListener(OnSuccessListener<Void> {
smsReceiver.setTimeout()
})
task.addOnFailureListener(OnFailureListener { e ->
showCodeInput()
})
3) Made BroadcastReceiver for SmsRetriever
inner class SmsBrReceiver : BroadcastReceiver() {
var h = Handler()
var r: Runnable = Runnable { doTimeout() }
fun setTimeout() {
h.postDelayed(r, 600000)
}
override fun onReceive(context: Context, intent: Intent?) {
val action = intent.action
if (SmsRetriever.SMS_RETRIEVED_ACTION == action) {
cancelTimeout()
val extras = intent.extras
val status = extras!!.get(SmsRetriever.EXTRA_STATUS) as Status
when (status.statusCode) {
CommonStatusCodes.SUCCESS -> { // not called
4) The SMS comes in format
u200bu200bPlease enter code: 1111 /appKeyXf56
And the app key at the end of SMS matches what the installed app signing key gives for generation as described here:
https://developers.google.com/identity/sms-retriever/verify#computing_your_apps_hash_string
CommonStatusCodes.SUCCESS does not get called after SMS is received, but CommonStatusCodes.TIMEOUT does get called after 5 minutes.
What is missing? Just in case gradle declarations for phone auth are:
com.google.android.gms:play-services-auth-api-phone:16.0.0
classpath "com.google.gms:google-services:4.2.0
android kotlin google-play-services sms-verification
add a comment |
Tried to implement SMS auto-reading for verification following the steps here:
https://developers.google.com/identity/sms-retriever/request
1) declared
lateinit var smsRetrieverClient: SmsRetrieverClient
private lateinit var smsReceiver: SmsBrReceiver
2) Initialised and registered them in login Activity onCreate
smsRetrieverClient = SmsRetriever.getClient(this)
smsReceiver = SmsBrReceiver()
val intentFilter = IntentFilter()
intentFilter.addAction(SmsRetriever.SMS_RETRIEVED_ACTION)
applicationContext.registerReceiver(smsReceiver, intentFilter)
val task = smsRetrieverClient.startSmsRetriever()
task.addOnSuccessListener(OnSuccessListener<Void> {
smsReceiver.setTimeout()
})
task.addOnFailureListener(OnFailureListener { e ->
showCodeInput()
})
3) Made BroadcastReceiver for SmsRetriever
inner class SmsBrReceiver : BroadcastReceiver() {
var h = Handler()
var r: Runnable = Runnable { doTimeout() }
fun setTimeout() {
h.postDelayed(r, 600000)
}
override fun onReceive(context: Context, intent: Intent?) {
val action = intent.action
if (SmsRetriever.SMS_RETRIEVED_ACTION == action) {
cancelTimeout()
val extras = intent.extras
val status = extras!!.get(SmsRetriever.EXTRA_STATUS) as Status
when (status.statusCode) {
CommonStatusCodes.SUCCESS -> { // not called
4) The SMS comes in format
u200bu200bPlease enter code: 1111 /appKeyXf56
And the app key at the end of SMS matches what the installed app signing key gives for generation as described here:
https://developers.google.com/identity/sms-retriever/verify#computing_your_apps_hash_string
CommonStatusCodes.SUCCESS does not get called after SMS is received, but CommonStatusCodes.TIMEOUT does get called after 5 minutes.
What is missing? Just in case gradle declarations for phone auth are:
com.google.android.gms:play-services-auth-api-phone:16.0.0
classpath "com.google.gms:google-services:4.2.0
android kotlin google-play-services sms-verification
Tried to implement SMS auto-reading for verification following the steps here:
https://developers.google.com/identity/sms-retriever/request
1) declared
lateinit var smsRetrieverClient: SmsRetrieverClient
private lateinit var smsReceiver: SmsBrReceiver
2) Initialised and registered them in login Activity onCreate
smsRetrieverClient = SmsRetriever.getClient(this)
smsReceiver = SmsBrReceiver()
val intentFilter = IntentFilter()
intentFilter.addAction(SmsRetriever.SMS_RETRIEVED_ACTION)
applicationContext.registerReceiver(smsReceiver, intentFilter)
val task = smsRetrieverClient.startSmsRetriever()
task.addOnSuccessListener(OnSuccessListener<Void> {
smsReceiver.setTimeout()
})
task.addOnFailureListener(OnFailureListener { e ->
showCodeInput()
})
3) Made BroadcastReceiver for SmsRetriever
inner class SmsBrReceiver : BroadcastReceiver() {
var h = Handler()
var r: Runnable = Runnable { doTimeout() }
fun setTimeout() {
h.postDelayed(r, 600000)
}
override fun onReceive(context: Context, intent: Intent?) {
val action = intent.action
if (SmsRetriever.SMS_RETRIEVED_ACTION == action) {
cancelTimeout()
val extras = intent.extras
val status = extras!!.get(SmsRetriever.EXTRA_STATUS) as Status
when (status.statusCode) {
CommonStatusCodes.SUCCESS -> { // not called
4) The SMS comes in format
u200bu200bPlease enter code: 1111 /appKeyXf56
And the app key at the end of SMS matches what the installed app signing key gives for generation as described here:
https://developers.google.com/identity/sms-retriever/verify#computing_your_apps_hash_string
CommonStatusCodes.SUCCESS does not get called after SMS is received, but CommonStatusCodes.TIMEOUT does get called after 5 minutes.
What is missing? Just in case gradle declarations for phone auth are:
com.google.android.gms:play-services-auth-api-phone:16.0.0
classpath "com.google.gms:google-services:4.2.0
android kotlin google-play-services sms-verification
android kotlin google-play-services sms-verification
asked Nov 26 '18 at 18:33
DemonickDemonick
1,53022332
1,53022332
add a comment |
add a comment |
1 Answer
1
active
oldest
votes
The solution was to shorten the message, although it seemed to not be over 140 bytes. After making the SMS text to ~30 characters auto-read of SMS works without other changes.
Thanks! You saved me so much debugging time
– Denis Nek
Dec 15 '18 at 0:07
Official doc said: >Be no longer than 140 bytes developers.google.com/identity/sms-retriever/verify
– Denis Nek
Dec 15 '18 at 0:14
add a comment |
Your Answer
StackExchange.ifUsing("editor", function () {
StackExchange.using("externalEditor", function () {
StackExchange.using("snippets", function () {
StackExchange.snippets.init();
});
});
}, "code-snippets");
StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "1"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});
function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});
}
});
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53487081%2fsms-verification-with-android-smsretrieverclient-not-parsing-message%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
The solution was to shorten the message, although it seemed to not be over 140 bytes. After making the SMS text to ~30 characters auto-read of SMS works without other changes.
Thanks! You saved me so much debugging time
– Denis Nek
Dec 15 '18 at 0:07
Official doc said: >Be no longer than 140 bytes developers.google.com/identity/sms-retriever/verify
– Denis Nek
Dec 15 '18 at 0:14
add a comment |
The solution was to shorten the message, although it seemed to not be over 140 bytes. After making the SMS text to ~30 characters auto-read of SMS works without other changes.
Thanks! You saved me so much debugging time
– Denis Nek
Dec 15 '18 at 0:07
Official doc said: >Be no longer than 140 bytes developers.google.com/identity/sms-retriever/verify
– Denis Nek
Dec 15 '18 at 0:14
add a comment |
The solution was to shorten the message, although it seemed to not be over 140 bytes. After making the SMS text to ~30 characters auto-read of SMS works without other changes.
The solution was to shorten the message, although it seemed to not be over 140 bytes. After making the SMS text to ~30 characters auto-read of SMS works without other changes.
answered Nov 29 '18 at 11:55
DemonickDemonick
1,53022332
1,53022332
Thanks! You saved me so much debugging time
– Denis Nek
Dec 15 '18 at 0:07
Official doc said: >Be no longer than 140 bytes developers.google.com/identity/sms-retriever/verify
– Denis Nek
Dec 15 '18 at 0:14
add a comment |
Thanks! You saved me so much debugging time
– Denis Nek
Dec 15 '18 at 0:07
Official doc said: >Be no longer than 140 bytes developers.google.com/identity/sms-retriever/verify
– Denis Nek
Dec 15 '18 at 0:14
Thanks! You saved me so much debugging time
– Denis Nek
Dec 15 '18 at 0:07
Thanks! You saved me so much debugging time
– Denis Nek
Dec 15 '18 at 0:07
Official doc said: >Be no longer than 140 bytes developers.google.com/identity/sms-retriever/verify
– Denis Nek
Dec 15 '18 at 0:14
Official doc said: >Be no longer than 140 bytes developers.google.com/identity/sms-retriever/verify
– Denis Nek
Dec 15 '18 at 0:14
add a comment |
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53487081%2fsms-verification-with-android-smsretrieverclient-not-parsing-message%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown