= Chapter 9 Notes = Title: '''Platform Specific API Calls''' == Summary == SAP and PCL Sound end platform information examples. === Programming Concepts Summary === || '''Concept''' || '''Page''' || || Dependency || 180ish || == Programs == === Program PlatInfoSap1 === Page 181. Concepts: 1. Uses #if and #elif, conditional compilation directives and the three platform symbols to show platform information Classes: 1. IOS: {{{UIDevice}}} is demonstrated. 1. Android: {{{Build}}} is demonstrated 1. Windows: {{{EasClientDeviceInformation}}} is demonstrated. === Program PlatInfoSap2 === Page 185. Concepts: 1. Uses SAP project with "parallel" classes - SAP project must share the same namespace as the project that is using it! NOT what is commonly done across projects. 1. Platform projects define identical classes with platform specific implementation, but with the namespace of the PCL project accessing the methods. Classes: Same as above. === Program DisplayPlatInfo === Page 188. Concepts: 1. Uses defined interface in PCL that is implemented in the platform projects with a special decoration like the following: {{{#!csharp [assembly: Dependency(typeof(DisplayPlatformInfo.iOS.PlatformInfo))] namespace DisplayPlatformInfo.Droid { public class PlatformInfo : IPlatformInfo { public string GetModel() { return String.Format("{0} {1}", Build.Manufacturer, Build.Model); } public string GetVersion() { return Build.VERSION.Release.ToString(); } } } }}} 1. Using the code from the PCL looks like this: {{{#!csharp ... IPlatformInfo platformInfo = DependencyService.Get(); modelLabel.Text = platformInfo.GetModel(); versionLabel.Text = platformInfo.GetVersion(); }}} Classes: 1. Demonstrations Dependency === Program MonkeyTapWithSound === Page 191. Concepts: 1. Mostly this is about sound, monaural sound to be specific 1. Pulse code modulation (PCM) 1. Platform projects define identical classes with platform specific implementation, but with the namespace of the PCL project accessing the methods. Classes: 1. introduces {{{PlatformSoundPlayer, IPlatformSoundPlayer}}} and many more related to monaural sound production!