windows universal app check tablet - c#

I am designing some application using Universal app from visual studio, and i would like some code to execute when the program is running on phone or tablet, the phone part is not a problem since i can use '#if WINDOWS_PHONE_APP' but how can I know if the application is on a tablet?

If you want to detect a keyboard, use the KeyboardCapabilities object. Note that starting with Windows 10, phone can also have wireless keyboards attached.

Related

AudioRoutingManager permissions on windows phone 8.1

hope everything is fine with you!
I got stuck trying to route my voip calls through earpiece on my windows phone 8.1 application. Before asking here, I did some google research and I found another thread called "how to play audio through earpiece only in windows phone 8 application".
There they suggest to use the AudioRoutingManager interface and it is available inside windows phone 8.1 SDK but whenever I call any method, the UnauthorizedAccessException is thrown. I can't add the ID_CAP_AUDIOROUTING and the ID_CAP_VOIP capabilities because they don't exist on windows phone 8.1 projects (I am using visual studio 2013).
Now one very important information: I am not using microsoft.phone.networking.voip classes. I have my own SIP stack implemented in cpp which I have already ported for many platforms, like Android, IOS, MAC, Symbian, Linux and now windows phone. This sip stack is working very well on windows phone, I can make calls for PSTN numbers and the audio is connected on both parts but I can't route the audio through earpiece, it is only played through speakers and I always get this UnauthorizedAccessException exception when I try to change the audio routing mode.
I have run out of ideas here and I am really considering to drop the window phone project if I can't overcome this limitation. Any help wiil be appreciated.
Thanks

Convert Universal app to Windows Phone app only

I am developing an Universal app capable of running on both Windows Phone and Windows. But initially I want it to be available to phones only because I have not made the Windows part of it. So how can I limit the target devices of this Universal app without creating a new app and without removing the Windows Code from it. I want it to be available to phones only for deployment. Can anybody give a solution?
Windows and Windows Phone apps are submitted separately to the Store. The process for submitting Windows apps is outlined here and for Phone here. So you can simply submit one without the other.
You can also stop building the Windows portion of the app using the Configuration Manager if you want to (to save time or avoid compilation errors you don't want to fix yet).

Reminders in Windows Phone Silverlight 8.1

Reminders in my app, Muslim Prayers works great on Windows Phone 8 and whenever a user taps on any reminder, it simply launches the app.
I have updated my phone to Windows Phone 8.1 and the same app works fine.
However, after re-targeting my app to Windows Phone Silverlight 8.1; the reminders do not launch an app upon tapping on it.
I want to know is this a known bug or am I missing something?
Thanks

ActivationPolicy="Replace" not working in Windows Phone 8.1

In Windows Phone 8.1 the default ActiovationPolicy changed from Replace to Resume.
I have a Windows Phone 8.1 Silverlight app and I want to use ActivationPolicy="Replace". Changing ActivationPolicy="Resume" to ActivationPolicy="Replace" does not work, the app still resumes.
I remember one video from build claiming that this should work, but is this really possible? If so, what is the way to make the app replace instead of resume?
Windows Phone 8.1 Silverlight apps always resume (http://social.msdn.microsoft.com/Forums/wpapps/en-US/caf0d79a-c55e-4046-afc1-86260c005205/activationpolicyreplace-not-working-in-windows-phone-81?forum=wpdevelop)

Make a phone call in Windows Phone 8.1

I'm writing a Universal App for Windows 8.1 / Windows Phone 8.1 that at some point displays a list of phone numbers. What I would like to do is allow the user to press one of these numbers and have the device call (or ask permission to call) that number if running on Windows Phone 8.1. I know this was previously possible in Windows Phone 8 by doing the following:
using Microsoft.Phone.Tasks;
PhoneCallTask phoneCallTask = new PhoneCallTask();
phoneCallTask.PhoneNumber = "2065550123";
phoneCallTask.DisplayName = "Gage";
phoneCallTask.Show();
NOTE: This code is wrapped in #if WINDOWS_PHONE_APP
However, when trying to import Microsoft.Phone.Tasks, Visual Studio is unable to find the reference. I know that "ID_CAP_PHONEDIALER" had to be enabled in WMAppManifest.xml in Windows Phone 8, but this doesn't seem to be possible with the universal app model. I've been searching around for a solution but can't find a recent one that includes Windows Phone 8.1 (not Silverlight).
Is there any way to make a phone call from within a universal app? Or is it simply not possible at the moment?
In Windows Phone 8.1, We can make phone call by "Windows.ApplicationModel.Calls.PhoneCallManager", just like this:
Windows.ApplicationModel
.Calls.PhoneCallManager
.ShowPhoneCallUI("phone number", "display name");

Categories

Resources