phone call in Windows 10 UWP - win-universal-app

Currently, I found Windows.ApplicationModel.Calls API. unable to make a call or launch different options available to make a call from my app.
And also I try this Code but still can't implement the Phone call function, any solutions for UWP? Thank You.
if (ApiInformation.IsApiContractPresent("Windows.ApplicationModel.Calls.CallsPhoneContract", 1,0))
{
PhoneCallManager.ShowPhoneCallUI("0213132131", "my name");
}

I've come with a solution that is working on emulator, I cannot test it on actual device, cause I don't own one.
PhoneCallStore PhoneCallStore = await PhoneCallManager.RequestStoreAsync();
Guid LineGuid = await PhoneCallStore.GetDefaultLineAsync();
PhoneLine = await PhoneLine.FromIdAsync(LineGuid);
PhoneLine.Dial(phoneNumber, nameToBeDisplayed);
You have to add Windows Mobile Extentions for UWP to references of your project as well as declare PhoneCall capability in app manifest.

The line,
PhoneCallManager.ShowPhoneCallUI("0213132131", "my name");
only shows the Call UI. It doesn't make a phone call.
You should use Windows.ApplicationModel.Calls.PhoneLine.Dial to make a phone call. See this for reference https://msdn.microsoft.com/en-us/library/windows.applicationmodel.calls.phoneline.aspx
See this example https://github.com/Microsoft/Windows-universal-samples/blob/master/Samples/PhoneCall/cs/Helpers/CallingInfo.cs#L85

Related

Google API SignIn HostedDomain cleanup problem

We implement the Sign-In on iOS using the Google API in our project. Customers must have a possibility to select the HostedDomain to limit the allowed account pull to the single domain.
SignIn.SharedInstance.HostedDomain = "domainName.com";
works perfectly.
The problem is when we want to Logout the user and log in it back with unrestricted HostedDomain
SignIn.SharedInstance.HostedDomain == null; // <-Default Value
When I try to set it to
SignIn.SharedInstance.HostedDomain=string.empty;
I filter everything.
When I try to set it to null
SignIn.SharedInstance.HostedDomain=null;
I get the exception.
Calling:
SignIn.SharedInstance.Dispose();
doesn't help.
The question is: How is possible to reset the HostedDomain filtering to the initial stage - allow everything without of the app restart.
Our implementation based on Xamarin iOS native, but we see the same problem in Swift or Objective-C.
The wrapper for the Gooogle SDK we use:
Xamarin.Google.iOS.SignIn

How to hide my app's calendar from built-in calendar app?

My app needs an internal calendar. I can create a new calendar like this:
var store = await AppointmentManager.RequestStoreAsync(AppointmentStoreAccessType.AppCalendarsReadWrite);
var cacheCalendar = await store.CreateAppointmentCalendarAsync("unique name here");
This succeeds and I get a new calendar. But this calendar is visible in the phone's built-in calendar app. I don't want this calendar to be visible since it's for internal bookkeeping.
So I try to hide the calendar like this:
var store = await AppointmentManager.RequestStoreAsync(AppointmentStoreAccessType.AppCalendarsReadWrite);
var cacheCalendar = await store.CreateAppointmentCalendarAsync("unique name here");
cacheCalendar.IsHidden = true; // <---- make calendar hidden
await cacheCalendar.SaveAsync(); // <---- save; error here
When calling SaveAsyncI get the following exception:
Access is denied. (Exception from HRESULT: 0x80070005
(E_ACCESSDENIED))"
Why can't I hide my calendar from the built-in phone calendar app? Is this an undocumented limitation? Are there other ways to do this?
(Note: I tested this on a Windows 10 Mobile as well as desktop Win 10 - same error.)
Edit/Addition: Since Anthony discovered the IsHidden property is documented as read-only in MSDN here is a screenshot from Visual Studio showing the public setter (which makes it compile, run and seemingly legit to call):
(The app targets Win 10 Build 10586 - maybe it's new, but unfinished?)
Honestly I am surprised this even compiles.
According to the MSDN documentation for AppointmentCalandar
IsHidden - Read-only - Gets whether the AppointmentCalendar is hidden in
the device's built-in calendar UI
This is a read only property and can't be set.
As for your actual question, after carfully reviewing the documentation it appears that this is an oversight in the API. I would raise this concern on the MSDN forums.
This was a bug in 10586 but if you’re using 14393 SDK you can use IsHidden if your app has rights to the calendar without an InvalidAccessException
https://wpdev.uservoice.com/forums/110705-universal-windows-platform/suggestions/15278775-appointmentcalendar-ishidden-setter-throws-a-inval

How to make outgoing calls in c#

I am trying to make outgoing call from C#.net 4.0, with pre-recorded message.I have
hiro usb modem h50113
already in the system to detect caller id.
I tried googling and found out few links
1.OZEKI
2.TWILIO
3. TAPI
in OZEKI I need to get SIP account not sure where to get that, and I am guessing that would cost me.
Twilio seems to be cheap but not sure how to use as there are codes like :
using System;
using Twilio;
class Example
{
static void Main(string[] args)
{
// Find your Account Sid and Auth Token at twilio.com/user/account
string AccountSid = "AC8ca11aff9660bdf011958a5718df9633";
string AuthToken = "{{ auth_token }}";
var twilio = new TwilioRestClient(AccountSid, AuthToken);
var options = new CallOptions();
options.Url = "http://demo.twilio.com/docs/voice.xml";
options.To = "+14155551212";
options.From = "+14158675309";
var call = twilio.InitiateOutboundCall(options);
Console.WriteLine(call.Sid);
}
}
Not sure where to write this code.
Also I think I can put use to usb-modem to make calls . So please advice what is the best possible way to achieve this and if possible in no cost.
Thanks
Twilio developer evangelist here.
If you are looking at making outgoing calls with Twilio, I suggest you follow this quick start guide on making calls in C#. It will take you through the basics.
For a more in depth look, I'd take a look through this tutorial on building a click to call system with C# ASP.NET MVC.
Let me know if that helps at all.
I am able to solve the issue . As I already had
hiro usb modem h50113
so i just used AT Command
ATDT (Phone number)
here is the code :
this.sp.WriteLine("ATDT 1234567890" + System.Environment.NewLine);
However , only it can ring , theirs no voice . Working on it as soon as I get it will post.
one can refer my old question for better understanding How to make caller id in c#.net

Chrome extension - Notification

How I can send a notification for everyone that has installed my extension?
I'm using new Notification(...) but the notification is just sending for me.
Thank you for all
You will want to use the new gcm service for Push Notifications via Google Cloud Messaging Service.
Here is a tutorial on Google's Chrome Developer page.
Well, this requires a lot of work already done in the extension to be able to do that without updating the extension.
For instance, your extension can periodically look for new notices on your website.
If you need more urgency, you either need to keep WebSocket connections to your server or use some manner of push services, like gcm API that Max Worg just mentioned.
That said, to use all this you need to have the support already in place in your extension.
Okay, but suppose you don't have that support, or don't need it that often.
The usual way to do it is with an extension update, where you add a message for the users and increment a variable with the "release notes" version, so that it will only be shown once. A good idea is to use chrome.storage.sync for this, so that the user won't be annoyed multiple times.
var message = "Sup user, check this out!";
var message_version = 4; // Update this when you want to show a new one
chrome.storage.sync.get(
{message_version: 0}, // Provide default
function(data) {
if(data.message_version < message_version) {
notify(message); // TODO: implement notify()
// Alternatively, open a page with the notice with chrome.tabs.create()
chrome.storage.sync.set({message_version: message_version});
}
}
);
You can see a real-life example here (using a hybrid of localStorage and chrome.storage).

Azure Notifications to WP and iOS

My app uses an Azure Notification Hub to send messages to both Windows Phone and iOS devices. The problem is that they work if one is called, but it doesn't work if both are called.
For example, If I send a message to an iOS device from my iOS emulator, the following code works fine and the notification appears.
var toast = PrepareMpnsToastPayload("myapp", notificationText);
var appleToast = PrepareAppleToastPayload("myapp", notificationText);
//await NotificationHelper.Instance.Hub.SendMpnsNativeNotificationAsync(toast, userTag);
await NotificationHelper.Instance.Hub.SendAppleNativeNotificationAsync(appleToast, userTag);
However, if I uncomment the SendMpns..() line, the notification never gets to the apple device. When stepping through this code with remote debugging, the call to SendMpns..() doesn't seem to return. I step over it and it just resumes.. and the breakpoint on the SendApple..() call below it never gets hit.
This works the same with the Windows Phone Mpns line (works fine without the apple call).
How am I supposed to send an alert to a user when I don't know what device they are on? I just want to send the notification to all types. Any pointers would be greatly appreciated.
EDIT: The below answers of removing await() did work. However as I now have authenticated notification hub I need to capture the return value of the call so I can see if I need to get another auth token if it has expired!
If posted code runs as trivial console application then we should wait for tasks to be completed. Easiest way to do so is removing await and calling Wait() against Task object returned by xAsync() methods:
NotificationHelper.Instance.Hub.SendMpnsNativeNotificationAsync(toast, userTag).Wait();
NotificationHelper.Instance.Hub.SendAppleNativeNotificationAsync(appleToast, userTag).Wait();

Resources