Tải bản đầy đủ (.pdf) (27 trang)

Session 04 kho tài liệu bách khoa

Bạn đang xem bản rút gọn của tài liệu. Xem và tải ngay bản đầy đủ của tài liệu tại đây (3.29 MB, 27 trang )

Advanced Windows Store Apps Development – II


 Explain the Windows Phone 8.1 Platform Features
 Explain Universal Apps
 Explain the process of Packaging an App
 Explain the process of Deploying an App

© Aptech Ltd.

Developing Universal Apps/Session 4

2


Microsoft introduced universal Windows apps for PCs, phones, and tablets with
Visual Studio 2013 Update. This Update for Windows Phone 8.1 is named as
‘Cortana’ and they have targeted mainly for gamers. For the non-gaming users,
the device will be faster and accessible in seconds.
Gain access to conclude a Live Tile, or press the search button, this update will
support most of the apps, calls, messages, searches, and music on the user phone.
Cortana interacts through the third-party apps, such as Facebook and Twitter to
share the links or test through the post.

Building Windows Store App

The user can develop the apps to target the mobile. To develop the app, the user has
to follow certain steps. These steps will demonstrate to create a HelloWorld app.

© Aptech Ltd.


Developing Universal Apps/Session 4

3


HelloWorld in Windows Phone
Step 1: Open Microsoft Blend and Select New Project. Select Windows Phone from the left side
menu and select Windows Phone App from the right side menu as shown in the following figure.

© Aptech Ltd.

Developing Universal Apps/Session 4

4


Step 2: Design the app page as shown in the following figure.

Step 3: Once the page design is completed, connect the Windows mobile to the PC and run the
application. The app will be installed in Windows phone. The user can view and access the app
directly from the device.

© Aptech Ltd.

Developing Universal Apps/Session 4

5


Following are the features of Windows phone 8.1.

Geolocation
Geolocation is upgraded by adding a new class called Geofencing. This API is used to
track the device up to a certain area and sends a notification whenever the device comes
within network coverage area. This API gives details about longitude and latitude.
Maps
Windows Phone 8.1 maps is upgraded with a new feature by viewing the map offline tiles
and improved routing. Using Map API, the developer can create map-based apps and
incorporate location and search features in the app.

Background transfers
Background transfer is used to transfer data in the background by calling the Background Task
features.

© Aptech Ltd.

Developing Universal Apps/Session 4

6


Windows Push Notification
Services (WNS)
Windows Phone 8.1 includes Windows Push Notification Services (WNS) to send Toast, Tile,
and Raw updates to the user device, which are received from a cloud service.

Controls
Windows Phone 8.1 is developed using the XAML framework. Similar to store apps, the
XAML controls for Phone 8.1 includes the basic and essential controls such as Button,
TextBlock, CheckBox, FlipView, GridView, ListView, Password, and
Zoom controls.

Globalization
Windows Phone 8.1 supports many international languages, which can be called through the
Globalization namespace. Using this feature it is possible to developed apps with
support to various international languages.

© Aptech Ltd.

Developing Universal Apps/Session 4

7


Calendar
Calendar is declared in a different way in Windows Phone 8.1 and supports Appointment
API. This API is also available for developing Windows Store apps with calendar features.

Browser
Internet Explorer 11 is enabled to allow Windows Phone 8.1 apps. This is possible using
WebView control provided in Windows Store apps. WebView supports features of HTML5
apps which is used to display responsive layouts.

External display support
Windows Phone enables the external display support by mirroring the phone display to PC
through a USB cable. The contents of phone can easily be displayed directly on the PC screen.

© Aptech Ltd.

Developing Universal Apps/Session 4

8



Data and storage
Windows.Storage API is associated to stream-based files. It allows the users to store data
locally. This will ask the user where to store the downloaded file.
Roaming
Windows Phone 8.1 supports roaming data. Roaming data feature is available when the lock
is enabled and the device is active. Roaming data files are stored inside the Roaming data
folder.
Share contact
Windows Phone 8.1 introduces share contact that allows sharing files, images, and videos to
any contact that is present in the current device. The data is generally shared using an e-mail.
SD card
In Windows Phone 8, only reading SD card was possible. However, now in Windows Phone
8.1, reading and writing to and from SD card is possible.

© Aptech Ltd.

Developing Universal Apps/Session 4

9


Microsoft has released Windows Phone 8.1 in the month of April 2014 which is named as
Cortana. This is enabled and available in Visual Studio 2013 with Update 2. These new features
allows the developers to build global apps, which works with phones, tablets, and PCs as well. In
order to develop universal app the user has to select Universal Apps from the New Project Menu as
shown in the following figure.

© Aptech Ltd.


Developing Universal Apps/Session 4

10


Windows Runtime app package will be created with an extension as .appx, which is ready-toinstall app in the devices.

This package will have following options:

App payload: App code files and assets

App manifest: App manifest file (AppxManifest.xml)

App block map: App package’s block map file (AppxBlockMap.xml)

App signature: App package’s digital signature file (AppxSignature.p7x)

© Aptech Ltd.

Developing Universal Apps/Session 4

11


To create the package the user has to follow some steps. When the
developer finishes developing the app completely, then it is ready
to be packed.
Step 1: After developing the app, navigate to Projects  Store 
Create App Packages as shown in the following figure.


© Aptech Ltd.

Developing Universal Apps/Session 4

12


Step 2: After selecting the menu, the Create App Packages will be
displayed as shown in the following figure. To test the app in the
local machine the user recommends selecting No from the option as
shown in figure.

© Aptech Ltd.

Developing Universal Apps/Session 4

13


Step 3: In this step, the developer has to provide the version and
build number details. This procedure is same as publishing the
Windows applications. After providing the version numbers click the
Create button to create the app package as shown in figure.

© Aptech Ltd.

Developing Universal Apps/Session 4

14



Once the app is published, the user can view the published app in their project folder.
To deploy the user has to click the Package file as shown in the following figure and run with
PowerShell.

© Aptech Ltd.

Developing Universal Apps/Session 4

15


Once the action menu is selected, the user can view the PowerShell window to confirm
whether to install the app in the device. The user has to type y and press Enter to start
deploying as shown in figure.

© Aptech Ltd.

Developing Universal Apps/Session 4

16


The user can see the installation progress as shown in figure.

© Aptech Ltd.

Developing Universal Apps/Session 4


17


Once the app is deployed, the user can view the completion progress of the app as shown in
figure.

© Aptech Ltd.

Developing Universal Apps/Session 4

18


Packaging and Deploying Your App
Step 1: Create a blank new application File  New Project  Blank App.
Step 2: Write the following code as shown in Code Snippet for designing the frontend.

Code Snippet:
x:Class=”AppPackageDemo.MainPage”
xmlns=” />xmlns:x=” />xmlns:local=”using:AppPackageDemo”
xmlns:d=” />xmlns:mc=” />mc:Ignorable=”d”>
<Grid Background=”{ThemeResourceApplicationPageBackgroundThemeBrush}”>
<TextBlock Text=”App Packing Demo” FontSize=”25” Margin=”570,368,473,363”>TextBlock>
</Grid>
</Page>
© Aptech Ltd.

Developing Universal Apps/Session 4


19


Step 3: The UI is displayed as shown in figure.

© Aptech Ltd.

Developing Universal Apps/Session 4

20


Step 4: After developing the app, Navigate to Projects  Store  Create App Packages as
shown earlier in figure.
Step 5: After selecting the menu, Create App Packages as shown earlier in figure.
To test the app in the local machine the user recommends selecting No from the given option, as
shown earlier in figure.
Step 6: In this step, the developer has to provide the version and build number details. This
procedure is same as publishing the Windows application. After providing the version numbers
click the Create button to create the app package as shown earlier in figure.
Step 7: Once the app is published, the user can view the published file in the project folder as
shown in the following figure.

© Aptech Ltd.

Developing Universal Apps/Session 4

21



Step 8: When the user views the published folder, the user can view the app package file,
which can be opened through PowerShell as shown in figure.

© Aptech Ltd.

Developing Universal Apps/Session 4

22


Step 9: To deploy, the user has to click the Package file as shown in figure and run with
PowerShell.

© Aptech Ltd.

Developing Universal Apps/Session 4

23


Step 10: Once the action menu selected, the user can view the PowerShell window to confirm
whether to install the app in the device. The user has to type y and press enter to start
deploying as shown earlier in figure.
Step 11: The user can view the installation process like the package file as shown in figure.

© Aptech Ltd.

Developing Universal Apps/Session 4


24


Step 12: Once the app is deployed, the user can view the completion progress of the app as
shown earlier in figure.
Step 13: The app will be displayed in the Windows tile as shown in figure.

© Aptech Ltd.

Developing Universal Apps/Session 4

25


×