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

Session 03 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 (4.11 MB, 33 trang )

Advanced Windows Store Apps Development – II


 Explain Trial Functionality
 Describe the process of In-app Purchase
 Explain the process of Advertising in Windows Store apps

© Aptech Ltd.

Generating Revenue Apps/Session 3

2


When users selects free trial or try from an app, the user is allowed to use the app up to certain
period, which may vary from 7 to 30 days. If the trial period ends, same user cannot use that app
anymore unless the app is purchased. Implementing the trial functionality for an app will help the
user in marketing the app, and Microsoft Apps Store recommends it.
It is recommended to implement these trial functionalities in an app so that user can get a chance
to evaluate the app.

© Aptech Ltd.

Generating Revenue Apps/Session 3

3


Time-Based Trials
To set a trial-based app, the user has to set a time or date calculation mechanism in the store
app. The store will take care of the app when the trial period ends, so the developer need


not worry about the usage of the app after trial period. While submitting the app in the store
the developer has to specify the trial period in days for the app as shown in figure. The trial
period starts when the user downloads and installs the app from the store.

© Aptech Ltd.

Generating Revenue Apps/Session 3

4


Feature-Differentiated Trials
When the app trial period expires, the developer can display a message to the customer regarding
the expiry of the trial period or send a notification in advance. The developer has to send these
reminders using the time-based trial period.
To check whether the app is in trial license, the developer can write code as shown in following
Code Snippet.
Code Snippet:
// function to check the licenseinfo
private async void fnLicenseInfo()
{
//license info is retrieved
var l = CurrentAppSimulator.LicenseInformation;
if (l.IsActive)
{
// check if there is any trial version, and show appropriate message

© Aptech Ltd.

Generating Revenue Apps/Session 3


5


Code Snippet (Cont.):
if (l.IsTrial)
{
await Dispatcher.RunAsync( Windows.UI.Core.CoreDispatcherPriority.Normal,()
=>
{
txtDetail.Text = “License status: Trial license”;
var r = (l.ExpirationDate - DateTime.Now).Days;
txtDetail.Text += System.Environment.NewLine + String.Format(“Remaining
days: {1}”, l.ExpirationDate, r); });
}
else
//otherwise set message to full version
{
await Dispatcher.RunAsync( Windows.UI.Core.CoreDispatcherPriority.Normal, ()
=>
{
txtDetail.Text = “License status: Full license”;
txtDetail.Text += “no expiry”;
}); }}
else
{
© Aptech Ltd.

Generating Revenue Apps/Session 3


6


Code Snippet (Cont.):
await Dispatcher.RunAsync( Windows.UI.Core.CoreDispatcherPriority.Normal, ()
=>
{
txtDetail.Text = “License status: license expired. Purchase the app!”;
});
}
}

When the code is executed, the output will be as shown in the following figure.

© Aptech Ltd.

Generating Revenue Apps/Session 3

7


 In-app purchase means the ability of an app to allow sale or
purchase of the app with the help of devices such as a mobile,
tablet, or a PC.
 Many times such in-app purchase is allowed within games and
other useful apps that allow the users to pay online and start
using all the features of the app.
 The user can easily purchase such an app without any trouble.
The apps are normally activated immediately after in-app
purchases.

 There is no need to download and update a fresh copy of the app
that is already downloaded and is running on the systems.
 To develop an app with in-app purchase feature, the user has to
create a .config file that includes all the information about the
app.
 This can be done by adding the code shown in Code Snippet to
the appropriate config file.
© Aptech Ltd.

Generating Revenue Apps/Session 3

8


Code Snippet:
<?xml version=”1.0” encoding=”utf-16” ?>
<CurrentApp>
<ListingInformation>
<App>
<AppId>00000000-0000-0000-0000-000000000000</AppId>
<LinkUri>
/></LinkUri>
<CurrentMarket>en-US</CurrentMarket>
<AgeRating>3</AgeRating>
<MarketData xml:lang=”en-us”>
<Name>LicenseTest</Name>
<Description>Will check the license info</Description>
<Price>10.00</Price>
<CurrencySymbol>$</CurrencySymbol>
<CurrencyCode>USD</CurrencyCode>

</MarketData>
</App>
<Product ProductId=”1” LicenseDuration=”0”>
© Aptech Ltd.

Generating Revenue Apps/Session 3

9


Code Snippet (Cont.):
<MarketData xml:lang=”en-us”>
<Name>License App</Name>
<Price>1.00</Price>
<CurrencySymbol>$</CurrencySymbol>
<CurrencyCode>USD</CurrencyCode>
</MarketData>
</Product>
</ListingInformation>
<LicenseInformation>
<App>
<IsActive>true</IsActive>
<IsTrial>true</IsTrial>
<ExpirationDate>2014-06-30T09:00:00.00Z</ExpirationDate>
</App>
<Product ProductId=”1”>
<IsActive>true</IsActive>
</Product>
</LicenseInformation>
</CurrentApp>

© Aptech Ltd.

Generating Revenue Apps/Session 3

10


In the Code Snippet, the user has to declare two elements, namely
ListingInformation and LicenseInformation. The listing information will
hold all the details of the app. This listing information will hold the app name,
description, pricing details; whereas, LicenseInformation will hold the app
license details such as trial details, expiry date (if trial), and product availability.
The following Code Snippet will get the xml file from the data folder. The xml file must
be saved under a folder called data folder.
Code Snippet:
private async System.Threading.Tasks.Task fnLoadLicenseInfo()
{
StorageFolder proxyDataFolder = await Package.Current.InstalledLocation.
GetFolderAsync(“Data”);
StorageFile proxyFile = await proxyDataFolder.GetFileAsync(“storelicense.
xml”);
await CurrentAppSimulator.ReloadSimulatorAsync(proxyFile);
}

© Aptech Ltd.

Generating Revenue Apps/Session 3

11



This is the most important step for setting up the correct license type for an app developed
by the user. To sell an app, the user must analyze and decide the correct pricing that can be
charged while selling this app. Price must be competitive than the other similar apps in the
market. Another possibility is that, if the user is allowed to try an app for a certain period,
he/she will be able to utilize the features of the app.

© Aptech Ltd.

Generating Revenue Apps/Session 3

12


Time Based Trial

Feature Based Trial

This is time based trial version of an app. It
will have all the features of the app, but after
a certain period, i.e. after the trial period, the
app will automatically expire and stop
execution. The user will not be able to use
the app further. The developer of the app can
set the period within the range of 1 day to
365 days.

© Aptech Ltd.

Featured apps will allow the users to access

the app up to a certain level until user
purchases the full version. For example, if the
user installs a trial version of a game app, the
app owner will be restricted and will be able
to play the game only up to certain levels.
Some of the levels in the game will be locked
so that the user cannot move and play the
next levels.

Generating Revenue Apps/Session 3

13


More ad platforms are available in Windows Store. The developer can develop an
advertisement, which pays him/her every time a customer clicks such advertisement. This is
known as Pay per Click (PPC). To integrate ads in the store app the developer has to register with
Microsoft pubCenter as shown in the following figure.

© Aptech Ltd.

Generating Revenue Apps/Session 3

14


The developer can manage their account from
and Windows Store dashboard. Visual
Studio 2013 includes some built-in connection for pubCenter, as shown in the
following figure.


© Aptech Ltd.

Generating Revenue Apps/Session 3

15


There are standard ad sizes to implement in the app. Table shows the standard ad
size and its unit id.

© Aptech Ltd.

Generating Revenue Apps/Session 3

16


After installing SDK, the user can view the ad control tool in the toolbox of
Visual Studio as shown in the following figure.

© Aptech Ltd.

Generating Revenue Apps/Session 3

17


The user can use AdControl to display ads in the application. Microsoft has provided an
application id for the developers to test the ad control. This application id is as follows:

Application ID: d25517cb-12d4-4699-8bdc-52040c712cab
To test the AdControl the user has to write the code as provided in following Code Snippet:
Code Snippet:
x:Class=”AdvertisementDemo.MainPage”
xmlns=” />xmlns:x=” />xmlns:local=”using:AdvertisementDemo”
xmlns:d=” />xmlns:mc=” />mc:Ignorable=”d”>
<Grid Background=”{ThemeResource ApplicationPageBackgroundThemeBrush}”>
ApplicationId=”d25517cb-12d4-4699-8bdc-52040c712cab”
AdUnitId=”10042999” Width=”728” Height=”90”
HorizontalAlignment=”Center” Margin=”0,10,0,0”/>
</Grid>
</Page>
© Aptech Ltd.

Generating Revenue Apps/Session 3

18


When the user executes the code, the advertising banner will be displayed as shown in
the following figure.

© Aptech Ltd.

Generating Revenue Apps/Session 3

19



Licensing an App - Licensing an app in Windows Store is made easy by Microsoft. Most of the
functionalities are in-built in the Store apps framework. Create a blank new application and add
code given in following Code Snippet to MainPage.xaml.
Code Snippet:
xmlns=” />xmlns:x=” xmlns:local=”using:TrialApp”
xmlns:d=” />xmlns:mc=” mc:Ignorable=”d”>
<Grid Background=”{ThemeResource ApplicationPageBackgroundThemeBrush}”>
VerticalAlignment=”Top” Margin=”603,300,0,0”/>
x:Name=”txtDetail” VerticalAlignment=”Top” Margin=”510,397,0,0”/>

×