Presentation is loading. Please wait.

Presentation is loading. Please wait.

Understanding Mobile App Development Concepts and Working with APIs Lesson 6.

Similar presentations


Presentation on theme: "Understanding Mobile App Development Concepts and Working with APIs Lesson 6."— Presentation transcript:

1 Understanding Mobile App Development Concepts and Working with APIs Lesson 6

2 Exam Objective Matrix Skills/ConceptsMTA Exam Objectives Developing Mobile Applications Manage the application life cycle. (4.1) Understanding Mobile Device APIs Understand mobile device APIs. (4.2)

3 The General Windows Phone OS 7.01 Application Life Cycle Terminated Launching Tombstoned Closing

4 Dormant App and Tombstoning Dormant application –Is still in memory but is not executing Tombstoning –Terminates an application but saves its state so it can be activated and resume where it left off

5 Exploring Windows Phone Applications Life Cycle Events Launching Deactivated Activated Closing

6 Code Stubs for the Launching, Activated, Deactivated, and Closing events

7 Page and Application States Page state –Information about a particular page in an application, like data entered into TextBox and TextBlock controls Application state –A set of information about an application –Includes data used by multiple pages in the application, such as Web service data or a user interface theme

8 Preserving Application State Information and Handling Activate/Deactivate Functions Application state data stored and retrieved through PhoneApplicationService.State property Deactivated event stores data through the property, whereas Activated event retrieves data IsApplicationInstancePreserved property of ActivatedEventArgs indicates whether the application is returning from dormant state or if tombstoned

9 Preserving Application State Information and Handling Activate/Deactivate Functions Page data is accessed during or after the page’s OnNavigatedTo method has been called and during or before the page’s OnNavigatedFrom method has been called OnNavigatedTo method called when user navigates to a page OnNavigatedFrom method called when user navigates away from a page, and when the application is deactivated

10 More on Tombstoning Tombstoned application has been deactivated but state information is stored If user navigates back to tombstoned application, it activates IsApplicationInstancePreserved property of ActivatedEventArgs indicates whether application is returning from a dormant state or was tombstoned

11 More on Tombstoning (continued) IsApplicationInstancePreserved takes on Boolean values –True means app was dormant, false means app was tombstoned Up to five applications can be tombstoned at a time Save data to persistent storage during the Deactivated event

12 Balancing Code between Battery Usage and Performance Ways to conserve battery: –Background audio –Fast Application Switching –Scheduled tasks

13 This Solution Includes an Application Project and a Background Agent Project

14 The CopyToIsolatedStorage Method

15 The OnPlayStateChanged Method

16 Providing User Feedback and Visible Status for Applications Provide user-friendly message when handling exceptions Use a progress bar Provide a cancel button Use a splash screen –Must be 480 pixels wide by 800 pixels tall –Must be named SplashScreenImage.jpg

17 A Progress Bar that Displays Red Dots across the Screen

18 Adding Text to the Splash Screen

19 A Custom Splash Screen

20 Storing Passwords Data Protection API (DPAPI) –Introduced in Windows 7.1 OS –Safely stores passwords, PINs, and other private data on a device –You must encrypt data ProtectedData class and Protect and Unprotect methods encrypt and decrypt data

21 Working with the NavigationService Class Enables users to navigate two or more pages in an application A frame is a kind of container that contains one or more pages A page is a Silverlight page that contains content –May include links and/or buttons A link or button lets the user move to another page

22 A Page within a Frame

23 Adding the NavigationService.Navigate Method

24 Modifications Made to SecondPage.xaml

25 Using Mapping and GeoLocation APIs Location API works with hardware and Microsoft Location Service to provide location information to applications Bing Maps Silverlight Control for Windows Phone displays maps in applications based on user input

26 The Bing Maps Sample MainPage.xaml.cs File

27 Part of App.xaml.cs for Bing Maps Sample

28 Understanding Forms in HTML5 Use start and end tags Most forms include the id attribute in the start tag Example:

29 The Fieldset Element Groups Related Elements in a Form and Adds a Border

30 Code for Simple Form < div id = "contact-form" style = "font-family:'Arial Narrow','Nimbus Sans L',sansserif;" > Name E mail

31 A Very Simple Form

32 The Beginning of a Web Form

33 A Web Form Using Tags to Align Fields Vertically

34 A Web form with Placeholders in Fields

35 Understanding Canvas A new element in HTML5 that creates a container for graphics Uses JavaScript to draw graphics dynamically Developers use canvas to create online games, rotating photo galleries, stock tickers, more

36 Understanding Canvas Canvas Test function f1() { var canvas = document.getElementById("smlRectangle"); context = canvas.getContext("2d"); context.fillStyle = "rgb(0,0,255)"; context.fillRect(10, 20, 200, 100); }

37 Web Page with a Canvas Shape

38 video Element Enables you to incorporate videos in HTML documents using minimal code Markup example:

39 video Attributes poster : Displays a static image file before the video loads autoplay : Start playing the video automatically upon page load controls : Displays a set of controls for playing, pausing, and stopping the video, and controlling the volume loop : Repeats the video

40 Video Markup Example

41 audio Element Enables you to incorporate audio (music, other sounds) in HTML documents using minimal code Markup example:

42 audio Example

43 Understanding Manipulation Events Windows Phone devices have four-point multi-touch screen for capturing gestures as input Standard gestures include tap, double tap, drag, flick, and pinch

44 Understanding Manipulation Events (cont.) System.Windows.Input.Touch.FrameRepo rted event is called when user creates individual touch contact points like tap, double tap, and hold ManipulationStarted, ManipulationDelta, and ManipulationCompleted events control more complicated gestures such as drag, pinch, and flick

45 Recap The application life cycle Windows Phone events Application state information and handling activate/deactivate functions Tombstoning Balancing code between battery usage and performance Providing user feedback and visible status for applications Storing passwords Mobile device application programming interfaces (APIs) The NavigationService class Mapping and GeoLocation APIs Forms, canvas, and media APIs in HTML5 Manipulation events


Download ppt "Understanding Mobile App Development Concepts and Working with APIs Lesson 6."

Similar presentations


Ads by Google