How to make use of Text to Speech in Windows Phone App - windows-phone-7

I am a newbie to Windows Phone App Development. I am building a Windows Phone App where I want the App to greet the logged in user and also greet when logging out.

You can make use of the built-in Text-To-Speech engine. It doesn't even need to connect to internet.
You can try something like this:
var text2speech = new SpeechSynthesizer();
await text2speech.SpeakTextAsync("Welcome to Text To Speech");
Hope it works. You can easily include this in a function and call it when the MainPage loads.
See more at: http://www.programfreaks.com/windowsphone/texttospeech.aspx

Related

Xamarin.Forms UI Automation Testing WaitForElement WebView always times out

My Xamarin.Forms app uses Azure AD B2C for authentication. It works great. I'm trying to build UI automation tests now and I ran into my first blocker. I have been trying to wait for the WebView to come on the screen so I can enter the email and password of a test user into my ui test automation script however the WaitForElement method always times out!
[Test]
public void RegistrationStarts()
{
app.Screenshot("Welcome screen.");
app.WaitForElement(c => c.WebView());
app.Tap(c => c.WebView().Css("input#logonIdentifier"));
app.EnterText("sample#example.com");
}
I'm not sure why. I'm only testing in Android. I notice that the Azure AD B2C login web view appears to be inside my app. I can tell this because when I open the Android task switcher I can see Chrome and my app.
Is there a reason you used input before the id? If logonIdentifier is your ID of whatever you want to type, it should just be
app.Tap(c => c.WebView().Css("#logonIdentifier"));
Also, if logonIdentifier is the TextBox in which you want to type, enter text should be
_app.EnterText(c => c.WebView().Css("#logonIdentifier"), "sample#example.com");
you can try wait for element with timeout - time in milisecond, second, and min.
app.WaitForElement(x => x.Marked("AutomationID"), timeout:TimeSpan.FromSeconds(90));
or
https://learn.microsoft.com/en-us/dotnet/api/xamarin.uitest.iapp.waitforelement?view=xamarin-uitest-sdk
It seems you are using systembrowser instead of WebView.
Change your method of acquiring token with WebView.
AuthenticationResult authResult = await _pca.AcquireTokenInteractive(B2CConstants.Scopes)
.WithUseEmbeddedWebView(true)
.ExecuteAsync();
https://github.com/microsoft/appcenter/issues/287#issuecomment-484151924

Using Sinch with Xamarin

I'm targetting iOS and Android platforms for a messaging application.
I want to use voice and messaging features of the sdk.
Are there any bindings available for sinch sdk for xamarin?
Sinch has a C# wrapper for sending SMS via their REST interface. It is available via a Nuget (Sinch.SMS) and/or you can grab the code on Github; https://github.com/sinch/Sinch.SMS
i.e. (from their hello world example):
To send an SMS use:
var client = new Sinch.SMS.Client("yourkey", "yoursecret");
var messageid = await client.SendSMS("+46722223355", "hello from sinch");
To check a status of an SMS use:
var client = new Sinch.SMS.Client("yourkey", "yoursecret");
var result = await client.CheckStatus(messageid);
As far as a complete SDK bindings for their Android/iOS SDKs, I do not know of one personally.
I 'just' would import them into XStudio and convert their sample call apps and give it a try. Should not take very long to see if the auto-wrappers work. Otherwise you would have manually correct/write the C# bindings to their 'native' lib
Here are some Xamarin binding libraries available on nuget. They are by a Vietnamese Software Development company called NAXAM. I believe these are all open source, and published on their github here: https://github.com/NAXAM
https://www.nuget.org/packages/Naxam.SinchVoice.Droid/
https://www.nuget.org/packages/Naxam.SinchVoice.iOS/3.11.0-pre1
https://www.nuget.org/packages/Naxam.SinchVerification.Droid/
https://www.nuget.org/packages/Naxam.SinchVerification.iOS/2.0.4-pre1

add a share button in Firefox OS application

I am creating a firefox OS application, I want the user to be able to share a link through any application installed and eligible (facebook, twitter etc). I saw android has this kind of feature and firefox OS has it as well, as I saw it in one of it's built in applications. Went through Web API, didn't find a suitable match,
Any ideas how to do it?
This is the intended use of the Web Activity API . The idea is that applications register to handle activities like share. The Firefox OS Boiler Plate app has several examples of using Web Activities. In that example a user could share a url using code like:
var share = document.querySelector("#share");
if (share) {
share.onclick = function () {
new MozActivity({
name: "share",
data: {
number: 1,
url: "http://robertnyman.com"
}
});
};
}
Any app that handles the share activity will be shown allowing the user to pick the proper app to handle the share.

Get title from website from webBrowser in WP7

I'm creating an app for the windows phone platform, and need to get the websites title as the user navigates through the web. I have tried many ways, but it just doesn't seem to work. Any ideas ?
This is what i have :
String title = (string)browser.InvokeScript("eval","document.title.toString()");
I don't know why the above answer was accepted as the right one:
The following line should work:
string webTitle = (string)Browser.InvokeScript("eval", "document.title.toString()");
if you call this in the navigated event it may not work, you MUST call this in Browser_LoadCompleted event, because only here all background processes finished and the invokeScript would work

navigator.network.connection.type always returns "unknown"

I am new to the phonegap. I am using it for WP7. I've been trying to
perform a simple test to get the connection type. I use this:
var networkState = navigator.network.connection.type;
console.log("networkState: "+networkState);
But it always displays "unknown" connection. I am using the windows
phone emulator that came with SDK. Is anyone having similar issues??
Plz help..

Resources