问题
I have created my application in UWP. I need to search current sim and sim Mobile number. Please help me for find the mobile number using windows phone 10 in c#
回答1:
Yes, it is possible. You can use SmsDevice2.AccountPhoneNumber to get the phone number. From this article,Pay attention of
This functionality is only available to mobile operator apps and Windows Store apps given privileged access by mobile network operators, mobile broadband adapter IHV, or OEM.
Hence it requires the cellularMessaging capability, a special-use capability, to be declared in the package manifest, so this kind of app can’t be published in Windows Store for normal developer
A relative sample of SMS you can reference SMS send and receive sample.
回答2:
You can't get the phone number from the device, whatever its type was, for a simple reason, that the mobile phone number is not stored on the SIM Card.
SIM Card holds contacts, SMSs, and network information along with an ID to link this SIM card to the User phone number.
so, don't try u will not get it from the SIM, but if it was stored manually in the device anyway else, you can get it then.
来源:https://stackoverflow.com/questions/45104594/is-there-any-way-to-fetch-mobile-number-of-windows-phone-10-using-c-sharp