0

We have the Windows.ApplicationModel.Contacts.ContactPicker to pick an contact from our contact list.

var contactPicker = new ContactPicker();
contactPicker.DesiredFieldsWithContactFieldType.Add(ContactFieldType.PhoneNumber);
Contact contact = await contactPicker.PickContactAsync();
if (contact?.Phones[0] is ContactPhone)
{
    foreach (ContactPhone phone in contact.Phones)
    {
        var result = phone.Number;
        // ...
    }
}
else
{
    // ...
}

But is it posible to get the holders mobile phone? I need to retrieve the phone number of the current phone holder.

soydachi
  • 851
  • 1
  • 9
  • 24

1 Answers1

2

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.

Sunteen Wu
  • 10,509
  • 1
  • 10
  • 21