Friday, February 7, 2014

MVA Course Advanced Windows Store App Development with HTML5 Jump Start Part 1

I worked through the first three modules of this course, which is focused on certain features of developing Windows 8 apps.  These features aren't all necessarily Windows 8 specific, but that was the focus of the course so far.



Here is the basic outline.  On the last three modules I might try taking notes while I watch the lectures so I can capture some of the things they talk about beyond what is in the Power Points....

Module 1: Background Tasks and Components
- Create background tasks
   - Background task runs code even it the app isn't running
   - Windows push notifications, playback manager for background audio, upload/download, share contracts
   - Appropriate for tasks such as downloading content for an app (like email), toast notifications (like chat requests), and updating a service with a change (like the user is present)
   - Not appropriate for computationally intensive tasks or anything requiring user interaction
   - How to create a background task:
      - create a JS worker file
 - implement behavior in worker file
 - register background task
 - declare background task in application manifest
   - Background task runs in the context of WorkerGlobalScope
- Consume background tasks
   - SystemEventTrigger or other trigger fires background task
   - Tasks can have conditions, and may require lock screen
   - Demo fires a notification when the user changes the time zone.
   - Difference between background task and web worker: Web workers don't run when app is not running, background tasks do run when the app is not running. Web workers are more of a performance enhancer (multi-threading)
- Integrate WinRT components into a solution
   - Allows us to define a block of code in C++, C#, or VB and then reuse the block of code in JS, C# etc.
   - Components improve performance, modularity, code reuse, and flexibility of language used.
   - Can't write WinRT component in JS
   - Demo used C++ and C# components in a calculator to do addition
 
Module 2: Hardware and sensors
   - Capture media with the camera and microphone
      - Easiest way to capture is CameraCaptureUI, powerful way is MediaCapture
 - CameraCaptureUI is an API that includes much of the UI components built in.
 - MediaCapture requires more setup but offers much greater flexibility.
 - <img> src can take a blog of binary data to display a picture, how the demo program used it
   - Get data from sensors
      - sensors include 3D accelerometer, 3D gyrometer, and 3D magnetometer
 - these sensors give us data on device orientation, inclination, and movement.
 - light sensor can read ambient light level to automatically dim display
 - compass gives us true north
 - accelerometer gives us movement in x, y, and z axis. "Shake" event already built in
   - Enumerate and discover device capabilities
      - Capability to discover device capabilities.
 - If removable storage or accelerometer are not present we can test for that
 - Geolocation depends on permission and possibly the presence of GPS receiver

Module 3:
 - Implement printing by using contracts and charms
    - Printing is invoked by a charm, requested by the app. Possible to control printing options
- demo allows us to toggle print registration, which is implemented using the printManager and
setting .onprinttaskrequested to some value. Setting to null unregisters app.
 - Implement PlayTo by using contracts and charms
    - PlayTo allows us to basically stream media from one device to another.
- sender device is the source of the media, receiver device displays the media.
- allows you to stream video from phone to laptop or tv.
 - Notify users by using Windows Push Notification Service (WNS)
    - Multiple ways to trigger notification:
   - in app
- background task
- third party push notification service
- windows push notification service - allows you to push notification from the cloud
- the hard way to implement push notifications is to write your own service
- easy way is to use WAMS (Windows Azure Mobile Services)
- http://codefoster.com/anatomyofpush
  - Windows asks WNS for a channel URI, which you securely send to a web service
  - Once that is done, the cloud service initiates with WNS
  - Then WNS handles communicating with Windows
- WAMS makes creating a push notification much easier.
  - You can see the push notification generated by the app through Azure
  - Foster's demo uses an asynchronous call to ensure that we have a channel URL before we try
  pushing a notification.

No comments:

Post a Comment