cjlotz / Xamarin.Plugins

Cross platform Xamarin Plugins
MIT License
113 stars 56 forks source link

iPad on iOS 8+ CanMakePhoneCall issue #37

Closed deckertron9000 closed 7 years ago

deckertron9000 commented 8 years ago

When running on an iPad with iOS 8 and above, CanMakePhoneCall returns true, even if the device cannot make a phone call. The actual attempt at placing a call then does nothing.

dfoulk commented 7 years ago

I am encountering this issue as well. I'm assuming that this repo is no longer supported, so I guess we are on our own. Take a look at this thread on SO: https://stackoverflow.com/questions/5094928/ios-detecting-whether-or-not-device-support-phone-calls which may help anyone coming to this issue!

dfoulk commented 7 years ago

@deckertron9000 - I found a quick-fix that simply allows us to check if the device is a phone:

MyViewModel.cs

public bool DeviceIsAPhone
{
    get
    {
        return (Device.Idiom == TargetIdiom.Phone);
    }
}

...

void ExecuteCallCommand()
{
    var messenger = CrossMessaging.Current.PhoneDialer;

    if (DeviceIsAPhone && messenger.CanMakePhoneCall)
        messenger.MakePhoneCall("867-5309", "Jenny");
}

I tried using the solution provided by rmacias here: https://forums.xamarin.com/discussion/33798/open-phone-dialer-from-app#Comment_106096 but on our iPad Mini, it did not achieve what we needed (due to the device returning a Network Code of "410"- even thought the iPad is not capable of making calls...). Still gonna explore this further, but for now, the property above works as a basic check.

deckertron9000 commented 7 years ago

@dfoulk - I suspect you are correct about this repo being dead content. I started building out some similar functionality to this plugin and ended up doing a similar workaround.

dfoulk commented 7 years ago

@deckertron9000 - Nice! Yeah, this check is better than nothing, but eventually I want to expand this check to verify that the phone has the ability to make calls (check Telephony, etc.).