I am working on Ionic
5 POC to get the user phone number. Can someone help me to implement "Obtain the user's phone number" in the angular
code?
Reference: link here
I tried to find Cordova / capacitor plugin but there is no plugin found that help to make hint request to get the phone number. If anyone can convert that code into angular, will be highly appreciated.
From the following code, in the
if (resultCode == RESULT_OK && data!=null)
block you need to get the phone number in the variablecredential
, here I am setting the phone number in a textfielduserMobileNo
you can do any other operation as per your requirement.And in the
else
part when no hints are available you can request focus on the textfield where the user has to enter the mobile number.Note: I have written the code in Kotlin but it will be automatically generated into Java in Android Studio