如何通过免费发送OTP来验证手机号码

时间:2016-10-25 14:17:29

标签: android mobile

我正在寻找免费的手机号码验证。因为我正在构建app,它必须通过发送OTP或未接来电来提供手机号码验证 但我希望它是免费的,没有任何限制。

2 个答案:

答案 0 :(得分:2)

我想这可能对你有帮助。

如果你有后端,你可以使用这个: SMS GATEWAY

如果不是这样,您可以使用任何SMS网关。这符合您的要求

答案 1 :(得分:0)

在乞讨中,您必须允许Manifest中的权限:android.permission.SEND_SMS android.permission.WRITE_SMS android.permission.RECEIVE_SMS

以及通过广播接收器类

公共类ReceiverSms扩展了BroadcastReceiver {

//Gives the random item to item var
function computerPlay() {
  const theArr = ["rock", "paper", "scissors"];
  var item = theArr[Math.floor(Math.random() * 3)];
  return item;
}

//Returns players selection
function playerPlay(e) {
  var pItem = e;
  console.log(`${e}`);
  return pItem;
}



var r = document.querySelector('.rock').addEventListener('click', playerPlay);
var p = document.querySelector('.paper').addEventListener('click', playerPlay);
var s = document.querySelector('.scissors').addEventListener('click', playerPlay);

var play = document.querySelector('.playbtn').addEventListener('click', playRound);

function playRound(playerSelection, computerSelection) {
  playerSelection = playerPlay();
  computerSelection = computerPlay();

  if (playerSelection == 'rock' && computerSelection == 'paper' || playerSelection == 'paper' && computerSelection == 'scissors' ||
    playerSelection == 'scissors' && computerSelection == 'rock') {
    window.alert(`${computerSelection} beats ${playerSelection} YOU LOST!`);
  } else if (playerSelection == computerSelection) {
    window.alert(`${computerSelection} and ${playerSelection} it is a DRAW!`);
  } else {
    window.alert(`${playerSelection} beats ${computerSelection} YOU WIN!!!`);
  }
}