Your SlideShare is downloading. ×
Develop Windows 8 & Windows Phone apps using crucial Google APIs
Upcoming SlideShare
Loading in...5
×

Thanks for flagging this SlideShare!

Oops! An error has occurred.

×

Introducing the official SlideShare app

Stunning, full-screen experience for iPhone and Android

Text the download link to your phone

Standard text messaging rates apply

Develop Windows 8 & Windows Phone apps using crucial Google APIs

1,070
views

Published on

This presentation I have done for Microsoft Champs community meetup in Colombo, Sri Lanka on 13th September 2013. In this presentation I have shown some examples on how to use some non-documented APIs …

This presentation I have done for Microsoft Champs community meetup in Colombo, Sri Lanka on 13th September 2013. In this presentation I have shown some examples on how to use some non-documented APIs in developing Windows 8 and Windows Phone apps

Published in: Technology

0 Comments
0 Likes
Statistics
Notes
  • Be the first to comment

  • Be the first to like this

No Downloads
Views
Total Views
1,070
On Slideshare
0
From Embeds
0
Number of Embeds
1
Actions
Shares
0
Downloads
11
Comments
0
Likes
0
Embeds 0
No embeds

Report content
Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
No notes for slide

Transcript

  • 1. Develop Windows 8 & Windows Phone apps using crucial Google APIs
  • 2. Isham Mohamed Mohamed Iqbal. Sabaragamuwa University of Sri Lanka. http://about.me/isham_mohamed_iqbal Feel free to disturb me in @isham_m_iqbal
  • 3. Agenda • Google Crucial APIs. • Calculator API. • Currency converter app. • Keyless calculator. • Text to speech in Windows Phone. • Text to speech for Windows 8 and 8.1 apps.
  • 4. Crucial APIs • Google have documented and provide access to many APIs – Eg : Maps API, Calendar API, Drive API • But there are some APIs used by Google for some critical purposes and those APIs are not provided with official Google documentations.
  • 5. Crucial APIs • Hackers managed to hack those kind of APIs to get backdoor access for them. • Google gives no-problem notice to use them. • Might be change in future. • Very interesting and easiest APIs to use. – Calculator API & Google TTS API.
  • 6. Calculator API • (1 / sin(30 deg)) - tan(30 radians) = ??? • For windows calculator we have to click “Sin” and “Tan buttons. • Even Bing app for Win 8 and Win 8.1 search app doesn't have any idea to solve this. • Using Bing or Google to solve this is quite easier.
  • 7. Calculator API
  • 8. Calculator API • Solution is accessing Google Calculator API • http://www.google.com/ig/calculator?hl=en& q= – Eg : http://www.google.com/ig/calculator?hl=en&q=24-8
  • 9. Calculator API • Any one plz try – http://www.google.com/ig/calculator?hl=en&q=24+8 • You need to encode the URL correctly since '+' is a reserved character. • So we need to use WebUtility.UrlEncode();
  • 10. Win 8 app using Calculator API
  • 11. WP 8 app using Calculator API
  • 12. WebClient vs HttpClient WebClient HttpClient Available in older version of .NET .NET 4.5 only. WinRT applications cannot use this HttpClient can be used with WinRT Provides progress reporting for downloads. No progress reporting for downloads. Supports FTP. No support for FTP. You need to new up a WebClient to make concurrent request. Single HttpClient can make concurrent requests. • Portable HttpClient for .NET Framework and Windows Phone release on Feb 2013. • Can be downloaded from https://nuget.org/packages/Microsoft.Net.Http
  • 13. Currency converter app • Using same calculator api with small modification – http://www.google.com/ig/calculator?hl=en&q=1usd=?lkr
  • 14. Get chart for currency converter app • Google finance API gives the chart for currency rates change – https://www.google.com/finance/chart?q=CURRENCY:USD LKR&tkr=1&p=5Y&chst=vkc&chs=1500x250&chsc=1
  • 15. Get a simple app • http://tiny.cc/MetroCurrencyConverter
  • 16. Text to speech in Windows Phone • You all know these basic things – Use the Windows.Phone.Speech.Synthesis API to generate synthesized speech. – Enable ID_CAP_SPEECH_RECOGNITION capability in the app manifest. – Very simple example : private async void ButtonSpeakMe_Click(object sender, RoutedEventArgs e) { SpeechSynthesizer synth = new SpeechSynthesizer(); await synth.SpeakTextAsync("This presentation is very boring!!"); }
  • 17. Text to speech in Windows Phone • And some advanced things – Change language with InstalledVoices class. – Change male / female voice with VoiceGender enum. – Very simple example : SpeechSynthesizer synth; private async void SpeakFrench_Click(object sender, RoutedEventArgs e) { synth = new SpeechSynthesizer(); IEnumerable<VoiceInformation> frenchVoices = from voice in InstalledVoices.All where voice.Language == "fr-FR" select voice; synth.SetVoice(frenchVoices.ElementAt(0)); await synth.SpeakTextAsync("Cette presentation est tres ennuyeux!"); }
  • 18. Text to speech in Windows 8 apps • How many of you have used native TTS feature in Win 8 apps?
  • 19. Text to speech in Windows 8 apps • Sadly no native TTS feature in Windows 8 & Win RT 1.0. • Bing translator API is provided but its really big process. – Register you clientID, clientSecter in https://datamarket.azure.com – Then you code must getting access token for login BingTranslator API – More detailed instructions are in http://msdn.microsoft.com/en- us/library/dd576287.aspx • Try Bing Translator API one day and you will know the pain.
  • 20. Text to speech in Windows 8 apps • Google have a solution for this problem • Available in – http://translate.google.com/translate_tts?tl=en&q=
  • 21. Text to speech in Windows 8 apps • How to get sound stream from web response? • MediaElement control will help us here. • Declare Background Tesks - > Audio in app Package.appxmanifest .
  • 22. Text to speech in Windows 8 apps • Set MediaElement control in .xaml page <MediaElement x:Name="medEle" AudioCategory="BackgroundCapableMedia" Height="100" Width="100"/>
  • 23. Text to speech in Windows 8 apps • Add this method in .xaml.cs page private void btnPlayClicked(object sender, RoutedEventArgs e) { string pathx = "http://translate.google.com/translate_tts?tl=en&q="+tb1.Text; medEle.Source = new Uri(pathx, UriKind.RelativeOrAbsolute); medEle.Play(); }
  • 24. Text to speech in Windows 8.1 apps • With Visual Studio 2013 prev, Microsoft is introducing Windows.Media.SpeechSynthesis namespace. • This feature is only available for Windows 8.1 and Windows RT 2.0 machines.
  • 25. Text to speech in Windows 8.1 apps • Set MediaElement control in .xaml page <MediaElement x:Name="medEle"/>
  • 26. Text to speech in Windows 8.1 apps • Add this method in .xaml.cs page private async void btnSpeak_click(object sender, RoutedEventArgs e) { MediaElement medEle = this.medEle; var synth = new Windows.Media.SpeechSynthesis.SpeechSynthesizer(); SpeechSynthesisStream stream = await synth.SynthesizeTextToStreamAsync(txtText.Text); medEle.SetSource(stream, stream.ContentType); medEle.Play(); }
  • 27. That’s all.. 