how can I fetch phone number for Android, IOS and Windows Phone.
For Windows Phone, you could get SIM MSISDN & IMSI number in Windows Phone Application. Please notice that you should manually edit your application Package.appxmanifest
as follows:
<Package xmlns="http://schemas.microsoft.com/appx/manifest/foundation/windows10"
xmlns:mp="http://schemas.microsoft.com/appx/2014/phone/manifest"
xmlns:uap="http://schemas.microsoft.com/appx/manifest/uap/windows10"
xmlns:rescap="http://schemas.microsoft.com/appx/manifest/foundation/windows10/restrictedcapabilities"
IgnorableNamespaces="uap mp rescap">
......
<Capabilities>
<rescap:Capability Name="cellularDeviceIdentity" />
</Capabilities>
You could use MobileBroadbandModem
class to get all CurrentDeviceInformation
. For more you could refer this case reply. Note you could not use code where in above case reply directly. You need to create DependencyService
for UWP project in your Xamarin.Forms
library.
For IOS, the short answer is "no way". You have to ask the user to enter it manually. There are private APIs to access the user's phone number, but then Apple will reject your app.