Make a phone call in Windows 8.1 - c#

To make a phone call in Windows Phone 8.1 I have to do the following:
Windows.ApplicationModel.Calls.ShowPhoneCallUI(number, name);
But in Windows 8.1 app there is no class PhoneCallManager in Windows.ApplicationModel.Calls namespace. Is there any way to make a phone call in Windows 8.1 store app?
Thanks in advance!

I've just googled for you and found that link.
http://msdn.microsoft.com/en-us/library/windows/apps/windows.applicationmodel.calls.phonecallmanager.aspx
Always try to stay on the newest stand in your programming network. I also found that:
Windows Phone 8.1 [Windows Runtime apps only]
is compatible to run
public static void ShowPhoneCallUI(
string phoneNumber,
string displayName
)
I think that microsoft is still updating their classes to 8.1 but you would be able to use already some namespaces.

On Windows Phone (!) you can either use
var phoneCallTask = new PhoneCallTask
{
PhoneNumber = number,
DisplayName = "The Name goes here"
};
phoneCallTask.Show();
or
Windows.ApplicationModel.Calls.PhoneCallManager.ShowPhoneCallUI(number, "The Name goes here");
Maybe you are simply missing an assembly reference?

Related

Windows 10 Universal App Feedback

How in Windows 10 Unviersal Application invoke Feedback Page in Store?
In Windows Phone 8.1 i used
await Windows.System.Launcher.LaunchUriAsync(
new Uri(#"ms-windows-store:reviewapp?appid=" + Windows.ApplicationModel.Store.CurrentApp.AppId));
but now it's not worked for me
Rather than reference an appid in the link use the PackageFamilyName
ms-windows-store://review/?PFN=xxxx
where xxxx comes from Windows.ApplicationModel.PackageId.FamilyName

Windows phone 8.1 create contact task

After reverting from windows phone 8.0 to windows phone 8.1, the save contact task no longer exists. All documentation on the internet state that now
You don't have write access to the primary contact store on Windows Phone 8.1, but you have the ability to create your own contact store.
this link on msdn clearly shows how can I add contacts implicitly to my contact store.
What's strange is that WhatsApp and Telegram both allow me to create a contact and choose the account type of it (outlook, ..) and on windows phone 8.1 !
Can anyone explain this?
If you're working with wp rt, your question is a duplicate of this question.
In that case, you have to create your own contact store for the app you're working on (code copied from the linked question's answer):
using Windows.Phone.PersonalInformation;
public async void addPerson() {
var store = await ContactStore.CreateOrOpenAsync();
var contact = new StoredContact(store) {
DisplayName = "Mike Peterson"
};
var props = await contact.GetPropertiesAsync();
props.add(KnownContactProperties.Email, "mike#peterson.com");
props.add(KnownContactProperties.MobileTelephone, "+1 212 555 1234");
await contact.SaveAsync();
}
In order for your app's contacts to appear in "People", each user needs to change the filter settings of their People-App accordingly.
Yes, I did similar things myself. The reason being the upgrade to windowsphone 8.1 brought restrictions on many apis which were released on windowsphone 8.0 like access to alarms, easy phone manager tasks were all changed because they were migrated from Silverlight to a new runtime. So if you'd still like to get accept to all those classes of Windowsphone 8.0 the trick is that is you first target your app to windowsphone 8.0 OS where you get access to all the classes. And then right clicking on the package explorer do a Windowsphone 8.1 Silverlight OS update. In that sense your app gets upgraded to windowsphone 8.1 while it still retains an intermediate namespace of windowsphone 8.0 allowing you to access all classes based for the old silverlight based OS.

Detect headphones in windows phone 8.1

For my Windows Phone 8.1 RT app I need to detect whether headphones are plugged in.
I found this questions which answers this issue for Windows Phone 8.0 and Windows Phone 8.1 Silverlight apps:
Windows Phone - Audio Endpoint Device
It tried this code in the code-behind of my main view (actually copied from http://developer.nokia.com/community/wiki/How_to_detect_the_audio_path_(headset_connection)_on_Windows_Phone):
AudioRoutingEndpoint currentAudioRoutingEndpoint = AudioRoutingManager.GetDefault().GetAudioEndpoint();
AudioRoutingManager.GetDefault().AudioEndpointChanged += AudioEndpointChanged_Handler;
and the handler:
private void AudioEndpointChanged_Handler(AudioRoutingManager sender, object args)
{
var audioEndPoint = sender.GetAudioEndpoint();
switch (audioEndPoint)
{
case AudioRoutingEndpoint.Default:
{
//default audio devide
break;
}
case AudioRoutingEndpoint.Earpiece:
{
//Earpiece
break;
}
case AudioRoutingEndpoint.Speakerphone:
{
//Speakerphone
break;
}
case AudioRoutingEndpoint.Bluetooth:
{
//Bluetooth
break;
}
case AudioRoutingEndpoint.WiredHeadset:
{
//WiredHeadset
break;
}
case AudioRoutingEndpoint.WiredHeadsetSpeakerOnly:
{
//WiredHeadsetSpeakerOnly
break;
}
case AudioRoutingEndpoint.BluetoothWithNoiseAndEchoCancellation:
{
//BluetoothWithNoiseAndEchoCancellation
break;
}
default:
throw new ArgumentOutOfRangeException();
}
}
If I run this code I get this exception:
System.UnauthorizedAccessException was unhandled by user code HResult=-2147024891
Message=Access is denied. (Exception from HRESULT: 0x80070005 (E_ACCESSDENIED))
I guess this is because the needed capabilities (ID_CAP_VOIP and ID_CAP_AUDIOROUTING) are missing.
Now my problem is that in my Windows Phone 8.1 RT app there is only a package.appxmanifest and no WMAppManifest.xml and it seems I can't define these capabilities anymore.
Please note that I really have no WMAppManifest.xml in my project as it would be in a Windows Phone 8.1 Silverlight project (there are in fact both available).
Is there a way to add these capabilities for my WP 8.1 RT app?
Or is there another way to detect headphones in Windows Phone 8.1 RT I just didn't found?
I would really appreciate any help!
EDIT: changed Windows Phone 8.1 xaml to Windows Phone 8.1 RT
So two things:
This feature is usable only during during a VOIP call, and only in the background task for the VOIP call - see the comments on this answer.
These VOIP features are only available to Windows Phone 8.1 Silverlight apps, and again, only in VOIP background tasks. So no luck for WinRT 8.1 or Universal apps. The MSDN documentation is here (A list of other features not available in Phone 8.1 WinRT here)
So.. you probably can't do what you want to do on Windows Phone (unless you're building a VOIP app).
What feature are you trying to implement with this? Maybe there is an alternative.
in WP8.1 Runtime you can create a xml file WindowsPhoneReserveAppInfo.xml with below code:
<?xml version="1.0" encoding="utf-8" ?>
<WindowsPhoneReservedAppInfo xmlns="http://schemas.microsoft.com/phone/2013/windowsphonereservedappinfo">
<SoftwareCapabilities>
<SoftwareCapability Id="ID_CAP_VOIP" />
</SoftwareCapabilities>
</WindowsPhoneReservedAppInfo>
It work fine. Good luck!

Open windows store in a windows phone silverlight app

I'm using silverlight to build apps for windows phone 7, 8.0 and 8.1
I have an URI in my code that contains ms-windows-store:PDP?PFN=SupportingComputersInc.Fhotoroom_pxc4cxt3rds1p
I'm trying to open the windows store to this specific app.
I found this code:
Launcher.LaunchUriAsync(uri);
But it is just opening xbox music. Then, I found that:
var options = new Windows.System.LauncherOptions();
options.PreferredApplicationPackageFamilyName = "SupportingComputersInc.Fhotoroom_pxc4cxt3rds1p";
options.PreferredApplicationDisplayName = "Fhotoroom app";
Launcher.LaunchUriAsync(uri, options);
But when I run this code I get a not implemented exception.
Is there another way to open the windows store on windows phone? Am I doing something bad here?
Windows Phone provides special launchers that should do the trick, for example to show a certain app's detail page in Store:
MarketplaceDetailTask marketplaceDetailTask = new MarketplaceDetailTask();
marketplaceDetailTask.ContentIdentifier = "INSERT_APP_ID";
marketplaceDetailTask.ContentType = MarketplaceContentType.Applications;
marketplaceDetailTask.Show();
For a summary of what else is possible (e.g., show the store's search result page for certain search key words) see Launchers for Windows Phone

DeviceNetworkInformation.IsCellularDataEnabled always returns false

I recently installed the Windows Phone 8.1 emulators to try some existing apps out on them and ran into this problem: DeviceNetworkInformation.IsCellularDataEnabled (in the Microsoft.Phone.Net.NetworkInformation namespace) is always returning false.
public void UpdateDataEnabled()
{
_dataEnabled = DeviceNetworkInformation.IsCellularDataEnabled
|| DeviceNetworkInformation.IsWiFiEnabled;
}
I know the connection is actually working because I'm still able to perform HTTP requests. If I run this same exact code in the 8.0.x emulators I don't have any problems.
I also tried updating the project and all libraries to Windows Phone Silverlight 8.1 apps to see if that would resolve the issue and no luck. I checked all the capabilities and ID_CAP_NETWORKING was still checked as well.
The emulator is tested and working if I write a pure Windows Phone 8.1 XAML app using Windows 8 method of obtaining network status. It's just not working for my Silverlight apps.
I was under the impression that Windows Phone Silverlight apps should continue to function on Windows Phone 8.1 devices. Am I overlooking something?
I have the same problem and i did what verdesrobert and Rishabh876 suggested. Its only emulator problem so i add condition to check out if app is running on emulator
public bool IsNetworkAvailable()
{
if (DeviceNetworkInformation.IsNetworkAvailable)
{
if (Microsoft.Devices.Environment.DeviceType == DeviceType.Emulator)
{
return true;
}
else if ((DeviceNetworkInformation.IsWiFiEnabled || DeviceNetworkInformation.IsCellularDataEnabled) && NetworkInterface.NetworkInterfaceType != NetworkInterfaceType.None)
{
return true;
}
}
return false;
}
I dont like that workaround much so if anyone has better solution let me know.
It seems that the WP8.1 emulator is giving that information only to WP8.1 apps.
I'm pretty sure that the 7.1 apps will work properly on WP8.1 Devices.

Categories