Sunday, January 27, 2019

How to do touch ID



function isAuthUsingTouchSupported()
{
  var status = kony.localAuthentication.getStatusForAuthenticationMode(constants.LOCAL_AUTHENTICATION_MODE_TOUCH_ID);
  alert("satatofisAuthUsingTouchSupported"+status);
  if(status == 5000)
   {
     kony.ui.Alert({message: "AUTHENTICATION BY TOUCHID SUPPORTED", alertType: constants.ALERT_TYPE_INFO, yesLabel:"Close"}, {});
   }
  else
   {
     var msg = "TOUCHID AUTHENTICATION RETURNED THE STATUS ::"+status;
     kony.ui.Alert({message: status, alertType: constants.ALERT_TYPE_INFO, yesLabel:"Close"}, {});
   }
}

function statusCB(status,message)
{
  if(status == 5000)
   {
     kony.ui.Alert({message: "AUTHENTICATION SUCCESSFULL", alertType: constants.ALERT_TYPE_INFO, yesLabel:"Close"}, {});
   }
  else
   {
     var messg = status+message;
     kony.ui.Alert({message: messg, alertType: constants.ALERT_TYPE_INFO, yesLabel:"Close"}, {});
   }
}
function authUsingTouchID()
{
  var config = {"promptMessage" : "PLEASE AUTHENTICATE USING YOUR TOUCH ID","fallbackTitle" :  "Please Enter your Password"};
  kony.localAuthentication.authenticate(constants.LOCAL_AUTHENTICATION_MODE_TOUCH_ID,statusCB,config);


}

In this only support IOS device:

function getBiometryTypeOfDevice(){
  var promptMessage = "Sign in with ";
  alert("typeofkonybio"+ kony.localAuthentication.getBiometryType());
  var Typof = kony.localAuthentication.getBiometryType();
  switch(Typof){
    case constants.BIOMETRY_TYPE_NONE:
      // Handle the case if the device doesn't support any biometryType
      break;        
    case constants.BIOMETRY_TYPE_TOUCHID:
      promptMessage += "TouchID";
      break;
    case constants.BIOMETRY_TYPE_FACEID:
      promptMessage += "FaceID";
      break;
    case constants.BIOMETRY_TYPE_UNDEFINED:
    
      // Handle the case if the device is not a iOS11 device (or) above
      break;
      
  }
   
}

0 comments:

Post a Comment