⇤ ← Revision 1 as of 2016-09-19 23:25:41
Size: 2345
Comment:
|
← Revision 2 as of 2016-09-26 14:46:32 ⇥
Size: 2354
Comment:
|
Deletions are marked like this. | Additions are marked like this. |
Line 1: | Line 1: |
= Chapter X Notes = | = Chapter 9 Notes = |
Line 12: | Line 12: |
|| Dependency || | || Dependency || 180ish || |
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:
- Uses #if and #elif, conditional compilation directives and the three platform symbols to show platform information
Classes:
IOS: UIDevice is demonstrated.
Android: Build is demonstrated
Windows: EasClientDeviceInformation is demonstrated.
Program PlatInfoSap2
Page 185.
Concepts:
- 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.
- 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:
- Uses defined interface in PCL that is implemented in the platform projects with a special decoration like the following:
[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(); } } }
- Using the code from the PCL looks like this:
... IPlatformInfo platformInfo = DependencyService.Get<IPlatformInfo>(); modelLabel.Text = platformInfo.GetModel(); versionLabel.Text = platformInfo.GetVersion();
Classes:
- Demonstrations Dependency
Program MonkeyTapWithSound
Page 191.
Concepts:
- Mostly this is about sound, monaural sound to be specific
- Pulse code modulation (PCM)
- Platform projects define identical classes with platform specific implementation, but with the namespace of the PCL project accessing the methods.
Classes:
introduces PlatformSoundPlayer, IPlatformSoundPlayer and many more related to monaural sound production!