SlideShare a Scribd company logo
1 of 38
Download to read offline
Notifications & Reminder, Contact
Nguyen Tuan | Microsoft Certified Trainer
Agenda
 Tiles in Windows Phone 8
 Local Tiles API
 Updating Tiles from ShellTileSchedule
 Updating Tiles from Background Agents
 Lock screen notifications for Windows Phone
 Lock screen background for Windows Phone
Live Tiles
• Windows phone has the unique ability to provide the
end user glanceableaccess to the information they
care most about, via Live Tiles
• Push Notifications offer developers a way to send
timely information
to their applications even when they are not running
• In Windows Phone 7.1 and later, the Local Tiles API
allows apps to create and update tiles
Live Tiles
• Shortcuts to apps
• All apps have at least one tile, known as the default tile
• Created by user pinning your app to the Start Screen
• Launch to app main page
• Apps can create secondary tiles
• Created programmatically
• Launch to any page in your app
• Static or dynamic
• Tiles can be updated
• Application code
• Background agents
• Push Notifications
• In Windows Phone 7.1, only one tile size for third party apps
• In Windows Phone 8.0, you can support three different tile sizes
4
Tile Templates and Tile Sizes
• Windows Phone 8 supports three Tile
templates
• Flip – flips from front to back (similar to
the WP 7.1 Tile template)
• Iconic – clean iconic layout designed to
reflect Windows Phone design principles
• Cycle – cycles through up to nine images
5
Tile Content
• The Tile content is built up from a fixed set of data properties
• Data Properties for Text elements, Count elements and Image elements
• Content that displays depends on the template you choose and the tile size
• Not all elements need to be used
• Not all elements used in all templates
• WXGA resolution Image sizes
• Automatically scaled for WVGA and 720p
6
Tile Size Flip and Cycle Images Iconic Images
Small 159 x 159 pixels 159 x 159 pixels 110 x 110 pixels
Medium 336 x 336 pixels 336 x 336 pixels 202 x 202 pixels
Wide 691 x 336 pixels 691 x 336 pixels N/A
Flip Tile Template
• Flips from front to
back
• Small size does not
flip
• Medium size is the
same as the WP7.1
tile template
8/16/2014 7
Cycle Tile Template
• Cycles between from 1 to 9 images
• Small tile does not cycle
8/16/2014 8
Iconic Tile Template
• Displays a small image in the center of the Tile and is designed to
reflect Windows Phone design principles
8/16/2014 9
Primary and Secondary Tiles
• Application Tile
• Can be created only when user taps and holds the application
name in the Application List and then selects pin to start
• Tile template and Properties are set initially in the Application
Manifest
• Template cannot be changed programmatically
• Secondary Tile
• Can be created only as the result of user input in an application
• The application then uses the Create(Uri, ShellTileData) method
to createa Tile on Start
• Because the UI will navigate to Start when a new secondary Tile
is created, only one secondary Tile can be created at a time
Defining the Application Tile
• Define your images
• The standard new project
templates already contain
placeholder images of the correct
size
• FlipCycleTile*.png used for the Flip
and Cycle Tile templates
• IconicTile*.png used for the Iconic
Tile templates
• Replace these images with your
own artwork
8/16/2014 11
Defining the Application Tile in the Application
Manifest
• Double-click WMAppManifest.xml to open using the new Manifest
Editor
• On the Application UI tab, set the Tile Template, optional Title and
Tile Images
8/16/2014 12
Demo:
Application Tile
Creating and Updating Tiles with the Local Tile API
• Localtileupdates(these are*not*push)
• Fullcontrolofallproperties whenyourapp
isintheforeground orbackground
• ManageSecondaryTiles
• Create/Update/Delete
• Launchesdirectly topage/experience
Creating Tiles
public static void SetTile(RecipeDataItem item, string NavSource)
{
FlipTileData tileData = new FlipTileData()
{
//Front square data
Title = item.Title,
BackgroundImage = new Uri("ms-appx:///background1.png", UriKind.Relative),
SmallBackgroundImage = new Uri("ms-appx:///smallbackground1.png", UriKind.Relative),
//Back square data
BackTitle = item.Title,
BackContent = item.Ingredients,
BackBackgroundImage = new Uri("ms-appx:///backbackground1.png", UriKind.Relative),
//Wide tile data
WideBackgroundImage = new Uri("ms-appx:///widebackground1.png", UriKind.Relative),
WideBackBackgroundImage = new Uri("ms-appx:///widebackbackground1.png", UriKind.Relative),
WideBackContent = item.Directions
};
// Create Tile and pin it to Start. Causes a navigation to Start and a deactivation of our application
ShellTile.Create(new Uri("/RecipePage.xaml?DefaultTitle=FromTile", UriKind.Relative), tileData, true);
}
Updating Tiles
// Find the Tile we want to update.
ShellTile TileToFind = ShellTile.ActiveTiles.FirstOrDefault(
x => x.NavigationUri.ToString().Contains("DefaultTitle=FromTile"));
// If the Tile was found, then update the Title.
if (TileToFind != null)
{
FlipTileData NewTileData = new FlipTileData
{
Title = textBoxTitle.Text
};
TileToFind.Update(NewTileData);
}
Updating the Application Tile
public static void UpdateMainTile(RecipeDataGroup group)
{
//Get application's main tile – application tile always first item in the ActiveTiles collection
//whether it is pinned or not
var mainTile = ShellTile.ActiveTiles.FirstOrDefault();
IconicTileData tileData = new IconicTileData()
{
Count = group.RecipesCount,
BackgroundColor = Color.FromArgb(255, 195, 61, 39),
Title = "Contoso Cookbooks",
IconImage =
new Uri("ms-appx:///local/shared/shellcontent/newMedLogo.png", UriKind.RelativeOrAbsolute),
SmallIconImage =
new Uri("ms-appx:///local/shared/shellcontent/newSmlLogo.png", UriKind.RelativeOrAbsolute),
WideContent1 = "Recent activity:",
WideContent2 = "Browsed " + group.Title + " group",
WideContent3 = "with total of " + group.RecipesCount + " recipes"
};
mainTile.Update(tileData);
}
Demo:
1.WPTileExample(Create, Update,Delete)
2.TilesApp(Update)
Updating Tiles with a Tile Schedule
• Periodically updates the tile image without pushing message though
• Can only update the image on the front of the tile
• Updates images only from the web, not from the app local store
• Sets up notification channel and binds it to a tile notification
• Few limitations
• Image size must be less than 150 KB (up from 80KB in WP7.1)
• Download time must not exceed 45 seconds (up from 30 seconds in 7.1)
• Lowest update time resolution is 60 minutes
• If the schedule for an indefinite or finite number of updates fails too many times, OS will cancel it
• Update recurrence can by Onetime, EveryHour, EveryDay, EveryWeek
or EveryMonth
19
Scheduling Tile Update
20
public partial class MainPage : PhoneApplicationPage
{
ShellTileSchedule SampleTileSchedule = new ShellTileSchedule();
private void buttonIndefinite_Click(object sender, RoutedEventArgs e)
{
// Updates will happen on a fixed interval.
SampleTileSchedule.Recurrence = UpdateRecurrence.Interval;
// Updates will happen every hour.
// Because MaxUpdateCount is not set, the schedule will run indefinitely.
SampleTileSchedule.Interval = UpdateInterval.EveryHour;
SampleTileSchedule.RemoteImageUri = new
Uri(@"http://www.weather.gov/forecasts/graphical/images/conus/MaxT1_conus.png");
// Updates will apply to the application tile.
SampleTileSchedule.Start();
}
}
Scheduling Secondary Tile Updates
21
foreach (ShellTile TileToSchedule in ShellTile.ActiveTiles)
{
ShellTileSchedule mySchedule = new ShellTileSchedule(TileToSchedule);
mySchedule.Interval = UpdateInterval.EveryHour;
mySchedule.Recurrence = UpdateRecurrence.Interval;
mySchedule.RemoteImageUri = imageURI;
mySchedule.Start();
}
• Can also schedule updates for secondary tiles by passing the ShellTile
object into the ShellTileSchedule constructor
Updating Tiles From a Background Agent
• In Windows Phone OS 7.0, only way of updatingLive Tiles was from a
Tile Schedule
or from Push Notifications
• Tile Schedule needs to fetch images from a web URI
• Push Notifications require you to implement a backend service
• To have control of shell tiles when the app is not running without
using Push Notifications, a good solution is a Background Agent
• Use the ShellTile API to locate and update tiles
Demo:
Update Tile From Agent
8/16/2014 24
Lock screen notifications
• End user can now select any app
that has been enabled for lock
screen notifications to show
detailed status
• Select any five apps to show quick
status (icon and count)
• For your app to be included in the
notifications area, all you have to
do is
• Create an icon
• Declare the app’s intent in the
application manifest file
8/16/2014 25
Lock Screen on Windows Phone 8
• Create a 24 x 24 pixel PNG image that will be used to identify your app
on the lock screen
•Contain only white pixels and transparent background
• Default name is LockIcon.png
•Use this name and you do not have to explicitly declare it in the application
manifest
• If you use another name,
•Edit WMAppManifest.xml using
the XML editor
•Change the DeviceLockImageURI
element which is listed inside the
Tokens element:
Creating a lock screen icon
8/16/2014 26
<Tokens>
<PrimaryToken TokenID="PhoneApp4Token" TaskName="_default">
<TemplateFlip>
…
<DeviceLockImageURI>MyLockIcon.png</DeviceLockImageURI>
</TemplateFlip>
</PrimaryToken>
</Tokens>
• Edit WMAppManifest.xml with the XML editor
•Find the <Extensions> element. If not there, create it immediately following the
<Tokens> element.
•Inside the <Extensions> element, create <Extension> elements for each feature
you want to support: Icon Count and/or Text
<Extensions>
<Extension ExtensionName="LockScreen_Notification_IconCount"
ConsumerID="{111DFF24-AA15-4A96-8006-2BFF8122084F}" TaskID="_default" />
<Extension ExtensionName="LockScreen_Notification_TextField"
ConsumerID="{111DFF24-AA15-4A96-8006-2BFF8122084F}" TaskID="_default" />
</Extensions>
Updating the Application Manifest File
8/16/2014 27
• Lock Screen Icon Count and Text is taken directly from your applications
primary tile
• Secondary tiles are not used for this feature
• Information is only displayed on the lock screen if the tile contains the
information
• For example, a count will only be displayed if the tile displays it
• Primary tile does not need to be pinned to the Start Screen for lock screen
notifications to be enabled
• Update Primary Tile content in the usual way
• LocalShell Tiles API
• Push Notifications
How to Update the Icon Count and Text
8/16/2014 28
• Simulation Dashboard allows
you to display the Lock Screen
on the emulator
• Access the Simulation
Dashboard from the Visual
Studio Tools menu
Testing with the Simulation Dashboard
8/16/2014 29
Demo:
Lock Screen
8/16/2014 31
Lock Screen Background
• End user can choose a background image
from their own photos or search for an
image on Bing
• In addition, they can choose an app to be
the background image provider
• For your app to be a lock screen
background provider, all you have to do is
• Declare the app’s intent in the application
manifest file
• Write code to change the background image
8/16/2014 32
Lock Screen Background
• Edit WMAppManifest.xml with the XML editor
•Find the <Extensions> element. If not there, create it immediately following the
<Tokens> element.
•Inside the <Extensions> element, create an <Extension> element for
LockScreen_Background
<Extensions>
<Extension ExtensionName="LockScreen_Background"
ConsumerID="{111DFF24-AA15-4A96-8006-2BFF8122084F}" TaskID="_default" />
</Extensions>
Updating the Application Manifest File
8/16/2014 33
Write Code to Change the Lock Screen Background
private async void lockHelper(Uri backgroundImageUri, string backgroundAction)
{
try
{
//If you're not the provider, this call will prompt the user for permission.
//Calling RequestAccessAsync from a background agent is not allowed.
var op = await LockScreenManager.RequestAccessAsync();
//Check the status to make sure we were given permission.
bool isProvider = LockScreenManager.IsProvidedByCurrentApplication;
if (isProvider)
{
//Do the update.
Windows.Phone.System.UserProfile.LockScreen.SetImageUri(backgroundImageUri);
System.Diagnostics.Debug.WriteLine("New current image set to {0}", backgroundImageUri.ToString());
}
else
{
MessageBox.Show("You said no, so I can't update your background.");
}
}
catch (System.Exception ex)
{
System.Diagnostics.Debug.WriteLine(ex.ToString());
}
}
• Call to
LockScreenManager.RequestAccess
Async is required
•Checks if your app is already the selected
lock screen background provider
•If not, prompts user for permission to make
your app the selected provider
User Confirmation
8/16/2014 35
//If you're not the provider, this call will prompt the user for permission.
//Calling RequestAccessAsync from a background agent is not allowed.
var op = await LockScreenManager.RequestAccessAsync();
• To use an image that you shipped in your app, use ms-appx:///
Uri imageUri = new Uri("ms-appx:///background1.png",
UriKind.RelativeOrAbsolute);
LockScreen.SetImageUri(imageUri);
• To use an image stored in the Local Folder, use ms-
appdata:///local/shared/shellcontent
• Must be in or below the /shared/shellcontent subfolder
Uri imageUri = new Uri("ms-
appdata:///local/shared/shellcontent/background2.png",
UriKind.RelativeOrAbsolute);
LockScreen.SetImageUri(imageUri);
Accessing Local Images
8/16/2014 36
Demo:
DynamicLockScreen
Summary
• Shell Tile API allows easy manipulation of tiles from within an application
• Tiles can have a front and a back, and apps can have secondary tiles
• Tiles and Toasts can launch into a specific page within the app
• Only the user can decide to pin an apps’ primary tile to the Start Screen, not from code
• App can declare in the App manifest that it can be a lock screen notification provider
• User must select apps to display lock screen notifications from phone Settings
• Optionally supply count and/or text – these are pulled directly from the primary tile
• App can also declare that it can be a lock screen background provider
• Code used to request permission from the user and to change the lock screen
background

More Related Content

Viewers also liked

Manual slideshare
Manual slideshareManual slideshare
Manual slideshareclemen07
 
Thinking at scale with hadoop
Thinking at scale with hadoopThinking at scale with hadoop
Thinking at scale with hadoopKen Krugler
 
Kennismaken met Systemisch Werk
Kennismaken met Systemisch WerkKennismaken met Systemisch Werk
Kennismaken met Systemisch WerkCoen de Cock
 
Наталья Касперская "Кого следует и кого не следует брать в бизнес"
Наталья Касперская "Кого следует и кого не следует брать в бизнес"Наталья Касперская "Кого следует и кого не следует брать в бизнес"
Наталья Касперская "Кого следует и кого не следует брать в бизнес"Ingria. Technopark St. Petersburg
 
A new standard for sourcing in the hemisphere
A new standard for sourcing in the hemisphereA new standard for sourcing in the hemisphere
A new standard for sourcing in the hemisphereMexico Fits
 
Beauty &amp; Care
Beauty &amp; CareBeauty &amp; Care
Beauty &amp; Careadfymenta
 
Wikis as water coolers?
Wikis as water coolers?Wikis as water coolers?
Wikis as water coolers?Scanenergi A/S
 
Evaluating Websites ULearn 09
Evaluating Websites ULearn 09Evaluating Websites ULearn 09
Evaluating Websites ULearn 09P H
 
Dev opsdayssv2014 devopsasrelationshipmanagement
Dev opsdayssv2014 devopsasrelationshipmanagementDev opsdayssv2014 devopsasrelationshipmanagement
Dev opsdayssv2014 devopsasrelationshipmanagementJames Urquhart
 
Business Case Guide
Business Case GuideBusiness Case Guide
Business Case Guideeuweben01
 
Scp B Factor Monthy 08 Yr End Edition
Scp B Factor Monthy 08 Yr End EditionScp B Factor Monthy 08 Yr End Edition
Scp B Factor Monthy 08 Yr End Editionmarilouguerrero
 
Waste Recycling | Biocity Studio
Waste Recycling | Biocity StudioWaste Recycling | Biocity Studio
Waste Recycling | Biocity StudioBiocity Studio
 
Utf8 giao trinh lr&sc
Utf8 giao trinh lr&scUtf8 giao trinh lr&sc
Utf8 giao trinh lr&scthungpin111
 
Chassidy’S Careers Portfolio
Chassidy’S Careers PortfolioChassidy’S Careers Portfolio
Chassidy’S Careers Portfolioguesta0ed2827
 
Filpbook Powerpoint Ryerson
Filpbook Powerpoint RyersonFilpbook Powerpoint Ryerson
Filpbook Powerpoint RyersonRyersonC
 

Viewers also liked (20)

Manual slideshare
Manual slideshareManual slideshare
Manual slideshare
 
Thinking at scale with hadoop
Thinking at scale with hadoopThinking at scale with hadoop
Thinking at scale with hadoop
 
Kennismaken met Systemisch Werk
Kennismaken met Systemisch WerkKennismaken met Systemisch Werk
Kennismaken met Systemisch Werk
 
Наталья Касперская "Кого следует и кого не следует брать в бизнес"
Наталья Касперская "Кого следует и кого не следует брать в бизнес"Наталья Касперская "Кого следует и кого не следует брать в бизнес"
Наталья Касперская "Кого следует и кого не следует брать в бизнес"
 
Information for visitors
Information for visitorsInformation for visitors
Information for visitors
 
WaveMaker Presentation
WaveMaker PresentationWaveMaker Presentation
WaveMaker Presentation
 
Jordan
JordanJordan
Jordan
 
A new standard for sourcing in the hemisphere
A new standard for sourcing in the hemisphereA new standard for sourcing in the hemisphere
A new standard for sourcing in the hemisphere
 
Beauty &amp; Care
Beauty &amp; CareBeauty &amp; Care
Beauty &amp; Care
 
Wikis as water coolers?
Wikis as water coolers?Wikis as water coolers?
Wikis as water coolers?
 
Evaluating Websites ULearn 09
Evaluating Websites ULearn 09Evaluating Websites ULearn 09
Evaluating Websites ULearn 09
 
Dev opsdayssv2014 devopsasrelationshipmanagement
Dev opsdayssv2014 devopsasrelationshipmanagementDev opsdayssv2014 devopsasrelationshipmanagement
Dev opsdayssv2014 devopsasrelationshipmanagement
 
Circuit
CircuitCircuit
Circuit
 
Business Case Guide
Business Case GuideBusiness Case Guide
Business Case Guide
 
Scp B Factor Monthy 08 Yr End Edition
Scp B Factor Monthy 08 Yr End EditionScp B Factor Monthy 08 Yr End Edition
Scp B Factor Monthy 08 Yr End Edition
 
Waste Recycling | Biocity Studio
Waste Recycling | Biocity StudioWaste Recycling | Biocity Studio
Waste Recycling | Biocity Studio
 
Utf8 giao trinh lr&sc
Utf8 giao trinh lr&scUtf8 giao trinh lr&sc
Utf8 giao trinh lr&sc
 
Leapin' Into Kindergarten
Leapin' Into KindergartenLeapin' Into Kindergarten
Leapin' Into Kindergarten
 
Chassidy’S Careers Portfolio
Chassidy’S Careers PortfolioChassidy’S Careers Portfolio
Chassidy’S Careers Portfolio
 
Filpbook Powerpoint Ryerson
Filpbook Powerpoint RyersonFilpbook Powerpoint Ryerson
Filpbook Powerpoint Ryerson
 

Similar to 07.Notifications & Reminder, Contact

Windows Phone 8 - 8 Tiles and Lock Screen Notifications
Windows Phone 8 - 8 Tiles and Lock Screen NotificationsWindows Phone 8 - 8 Tiles and Lock Screen Notifications
Windows Phone 8 - 8 Tiles and Lock Screen NotificationsOliver Scheer
 
Windows Phone 8 More Than An App
Windows Phone 8 More Than An AppWindows Phone 8 More Than An App
Windows Phone 8 More Than An AppNguyên Phạm
 
Windows phone 8 session 11
Windows phone 8 session 11Windows phone 8 session 11
Windows phone 8 session 11hitesh chothani
 
Windows Phone 8 - 17 The Windows Phone Store
Windows Phone 8 - 17 The Windows Phone StoreWindows Phone 8 - 17 The Windows Phone Store
Windows Phone 8 - 17 The Windows Phone StoreOliver Scheer
 
13.Windows Phone Store
13.Windows Phone Store13.Windows Phone Store
13.Windows Phone StoreNguyen Tuan
 
Developing Apps for Windows Phone 8
Developing Apps for Windows Phone 8Developing Apps for Windows Phone 8
Developing Apps for Windows Phone 8KMS Technology
 
Tips and tricks of the 2021.4 release
Tips and tricks of the 2021.4 releaseTips and tricks of the 2021.4 release
Tips and tricks of the 2021.4 releaseCristina Vidu
 
A look behind the scenes: Windows 8 background processing
A look behind the scenes: Windows 8 background processingA look behind the scenes: Windows 8 background processing
A look behind the scenes: Windows 8 background processingMatt Lacey
 
Introduction to Android for Quality Engineers
Introduction to Android for Quality EngineersIntroduction to Android for Quality Engineers
Introduction to Android for Quality EngineersAhmed Faidy
 
Modello, More Than Just a Pretty Picture
Modello, More Than Just a Pretty PictureModello, More Than Just a Pretty Picture
Modello, More Than Just a Pretty PictureRyo Jin
 
Presentation - Windows App Development - II - Mr. Chandan Gupta
Presentation - Windows App Development - II - Mr. Chandan GuptaPresentation - Windows App Development - II - Mr. Chandan Gupta
Presentation - Windows App Development - II - Mr. Chandan GuptaMobileNepal
 
Windows 8 DevUnleashed - Session 3
Windows 8 DevUnleashed - Session 3Windows 8 DevUnleashed - Session 3
Windows 8 DevUnleashed - Session 3drudolph11
 
03.Controls in Windows Phone
03.Controls in Windows Phone03.Controls in Windows Phone
03.Controls in Windows PhoneNguyen Tuan
 
Emixa Mendix Meetup 11 April 2024 about Mendix Native development
Emixa Mendix Meetup 11 April 2024 about Mendix Native developmentEmixa Mendix Meetup 11 April 2024 about Mendix Native development
Emixa Mendix Meetup 11 April 2024 about Mendix Native developmentPim van der Noll
 
MWC/ADC 2013 Live Tiles and Lock Screen for Windows Phone
MWC/ADC 2013 Live Tiles and Lock Screen for Windows PhoneMWC/ADC 2013 Live Tiles and Lock Screen for Windows Phone
MWC/ADC 2013 Live Tiles and Lock Screen for Windows PhoneMicrosoft Mobile Developer
 
Introduce anypoint studio
Introduce anypoint studioIntroduce anypoint studio
Introduce anypoint studioSon Nguyen
 
Phonegap - An Introduction
Phonegap - An IntroductionPhonegap - An Introduction
Phonegap - An IntroductionTyler Johnston
 
Google IO 2014 overview
Google IO 2014 overviewGoogle IO 2014 overview
Google IO 2014 overviewBin Yang
 

Similar to 07.Notifications & Reminder, Contact (20)

Windows Phone 8 - 8 Tiles and Lock Screen Notifications
Windows Phone 8 - 8 Tiles and Lock Screen NotificationsWindows Phone 8 - 8 Tiles and Lock Screen Notifications
Windows Phone 8 - 8 Tiles and Lock Screen Notifications
 
Windows Phone 8 More Than An App
Windows Phone 8 More Than An AppWindows Phone 8 More Than An App
Windows Phone 8 More Than An App
 
Windows phone 8 session 11
Windows phone 8 session 11Windows phone 8 session 11
Windows phone 8 session 11
 
Windows Phone 8 - 17 The Windows Phone Store
Windows Phone 8 - 17 The Windows Phone StoreWindows Phone 8 - 17 The Windows Phone Store
Windows Phone 8 - 17 The Windows Phone Store
 
13.Windows Phone Store
13.Windows Phone Store13.Windows Phone Store
13.Windows Phone Store
 
Developing Apps for Windows Phone 8
Developing Apps for Windows Phone 8Developing Apps for Windows Phone 8
Developing Apps for Windows Phone 8
 
Tips and tricks of the 2021.4 release
Tips and tricks of the 2021.4 releaseTips and tricks of the 2021.4 release
Tips and tricks of the 2021.4 release
 
A look behind the scenes: Windows 8 background processing
A look behind the scenes: Windows 8 background processingA look behind the scenes: Windows 8 background processing
A look behind the scenes: Windows 8 background processing
 
Introduction to Android for Quality Engineers
Introduction to Android for Quality EngineersIntroduction to Android for Quality Engineers
Introduction to Android for Quality Engineers
 
Modello, More Than Just a Pretty Picture
Modello, More Than Just a Pretty PictureModello, More Than Just a Pretty Picture
Modello, More Than Just a Pretty Picture
 
Presentation - Windows App Development - II - Mr. Chandan Gupta
Presentation - Windows App Development - II - Mr. Chandan GuptaPresentation - Windows App Development - II - Mr. Chandan Gupta
Presentation - Windows App Development - II - Mr. Chandan Gupta
 
Windows 8 DevUnleashed - Session 3
Windows 8 DevUnleashed - Session 3Windows 8 DevUnleashed - Session 3
Windows 8 DevUnleashed - Session 3
 
03.Controls in Windows Phone
03.Controls in Windows Phone03.Controls in Windows Phone
03.Controls in Windows Phone
 
Emixa Mendix Meetup 11 April 2024 about Mendix Native development
Emixa Mendix Meetup 11 April 2024 about Mendix Native developmentEmixa Mendix Meetup 11 April 2024 about Mendix Native development
Emixa Mendix Meetup 11 April 2024 about Mendix Native development
 
Windows Phone Introduction
Windows Phone IntroductionWindows Phone Introduction
Windows Phone Introduction
 
MWC/ADC 2013 Live Tiles and Lock Screen for Windows Phone
MWC/ADC 2013 Live Tiles and Lock Screen for Windows PhoneMWC/ADC 2013 Live Tiles and Lock Screen for Windows Phone
MWC/ADC 2013 Live Tiles and Lock Screen for Windows Phone
 
Syncitall
SyncitallSyncitall
Syncitall
 
Introduce anypoint studio
Introduce anypoint studioIntroduce anypoint studio
Introduce anypoint studio
 
Phonegap - An Introduction
Phonegap - An IntroductionPhonegap - An Introduction
Phonegap - An Introduction
 
Google IO 2014 overview
Google IO 2014 overviewGoogle IO 2014 overview
Google IO 2014 overview
 

More from Nguyen Tuan

12.Maps and Location
12.Maps and Location12.Maps and Location
12.Maps and LocationNguyen Tuan
 
11.Open Data Protocol(ODATA)
11.Open Data Protocol(ODATA) 11.Open Data Protocol(ODATA)
11.Open Data Protocol(ODATA) Nguyen Tuan
 
10.Local Database & LINQ
10.Local Database & LINQ10.Local Database & LINQ
10.Local Database & LINQNguyen Tuan
 
09.Local Database Files and Storage on WP
09.Local Database Files and Storage on WP09.Local Database Files and Storage on WP
09.Local Database Files and Storage on WPNguyen Tuan
 
08.Push Notifications
08.Push Notifications 08.Push Notifications
08.Push Notifications Nguyen Tuan
 
06.Programming Media on Windows Phone
06.Programming Media on Windows Phone06.Programming Media on Windows Phone
06.Programming Media on Windows PhoneNguyen Tuan
 
05.Blend Expression, Transformation & Animation
05.Blend Expression, Transformation & Animation05.Blend Expression, Transformation & Animation
05.Blend Expression, Transformation & AnimationNguyen Tuan
 
04.Navigation on Windows Phone
04.Navigation on Windows Phone04.Navigation on Windows Phone
04.Navigation on Windows PhoneNguyen Tuan
 
02.Designing Windows Phone Application
02.Designing Windows Phone Application02.Designing Windows Phone Application
02.Designing Windows Phone ApplicationNguyen Tuan
 

More from Nguyen Tuan (9)

12.Maps and Location
12.Maps and Location12.Maps and Location
12.Maps and Location
 
11.Open Data Protocol(ODATA)
11.Open Data Protocol(ODATA) 11.Open Data Protocol(ODATA)
11.Open Data Protocol(ODATA)
 
10.Local Database & LINQ
10.Local Database & LINQ10.Local Database & LINQ
10.Local Database & LINQ
 
09.Local Database Files and Storage on WP
09.Local Database Files and Storage on WP09.Local Database Files and Storage on WP
09.Local Database Files and Storage on WP
 
08.Push Notifications
08.Push Notifications 08.Push Notifications
08.Push Notifications
 
06.Programming Media on Windows Phone
06.Programming Media on Windows Phone06.Programming Media on Windows Phone
06.Programming Media on Windows Phone
 
05.Blend Expression, Transformation & Animation
05.Blend Expression, Transformation & Animation05.Blend Expression, Transformation & Animation
05.Blend Expression, Transformation & Animation
 
04.Navigation on Windows Phone
04.Navigation on Windows Phone04.Navigation on Windows Phone
04.Navigation on Windows Phone
 
02.Designing Windows Phone Application
02.Designing Windows Phone Application02.Designing Windows Phone Application
02.Designing Windows Phone Application
 

Recently uploaded

Android Application Components with Implementation & Examples
Android Application Components with Implementation & ExamplesAndroid Application Components with Implementation & Examples
Android Application Components with Implementation & ExamplesChandrakantDivate1
 
Leading Mobile App Development Companies in India (2).pdf
Leading Mobile App Development Companies in India (2).pdfLeading Mobile App Development Companies in India (2).pdf
Leading Mobile App Development Companies in India (2).pdfCWS Technology
 
FULL ENJOY - 9999218229 Call Girls in {Mahipalpur}| Delhi NCR
FULL ENJOY - 9999218229 Call Girls in {Mahipalpur}| Delhi NCRFULL ENJOY - 9999218229 Call Girls in {Mahipalpur}| Delhi NCR
FULL ENJOY - 9999218229 Call Girls in {Mahipalpur}| Delhi NCRnishacall1
 
9999266834 Call Girls In Noida Sector 52 (Delhi) Call Girl Service
9999266834 Call Girls In Noida Sector 52 (Delhi) Call Girl Service9999266834 Call Girls In Noida Sector 52 (Delhi) Call Girl Service
9999266834 Call Girls In Noida Sector 52 (Delhi) Call Girl Servicenishacall1
 
Mobile Application Development-Components and Layouts
Mobile Application Development-Components and LayoutsMobile Application Development-Components and Layouts
Mobile Application Development-Components and LayoutsChandrakantDivate1
 
Mobile Application Development-Android and It’s Tools
Mobile Application Development-Android and It’s ToolsMobile Application Development-Android and It’s Tools
Mobile Application Development-Android and It’s ToolsChandrakantDivate1
 
Thane 💋 Call Girls 7738631006 💋 Call Girls in Thane Escort service book now. ...
Thane 💋 Call Girls 7738631006 💋 Call Girls in Thane Escort service book now. ...Thane 💋 Call Girls 7738631006 💋 Call Girls in Thane Escort service book now. ...
Thane 💋 Call Girls 7738631006 💋 Call Girls in Thane Escort service book now. ...Pooja Nehwal
 

Recently uploaded (8)

Android Application Components with Implementation & Examples
Android Application Components with Implementation & ExamplesAndroid Application Components with Implementation & Examples
Android Application Components with Implementation & Examples
 
Leading Mobile App Development Companies in India (2).pdf
Leading Mobile App Development Companies in India (2).pdfLeading Mobile App Development Companies in India (2).pdf
Leading Mobile App Development Companies in India (2).pdf
 
FULL ENJOY - 9999218229 Call Girls in {Mahipalpur}| Delhi NCR
FULL ENJOY - 9999218229 Call Girls in {Mahipalpur}| Delhi NCRFULL ENJOY - 9999218229 Call Girls in {Mahipalpur}| Delhi NCR
FULL ENJOY - 9999218229 Call Girls in {Mahipalpur}| Delhi NCR
 
9999266834 Call Girls In Noida Sector 52 (Delhi) Call Girl Service
9999266834 Call Girls In Noida Sector 52 (Delhi) Call Girl Service9999266834 Call Girls In Noida Sector 52 (Delhi) Call Girl Service
9999266834 Call Girls In Noida Sector 52 (Delhi) Call Girl Service
 
Mobile Application Development-Components and Layouts
Mobile Application Development-Components and LayoutsMobile Application Development-Components and Layouts
Mobile Application Development-Components and Layouts
 
Mobile Application Development-Android and It’s Tools
Mobile Application Development-Android and It’s ToolsMobile Application Development-Android and It’s Tools
Mobile Application Development-Android and It’s Tools
 
Thane 💋 Call Girls 7738631006 💋 Call Girls in Thane Escort service book now. ...
Thane 💋 Call Girls 7738631006 💋 Call Girls in Thane Escort service book now. ...Thane 💋 Call Girls 7738631006 💋 Call Girls in Thane Escort service book now. ...
Thane 💋 Call Girls 7738631006 💋 Call Girls in Thane Escort service book now. ...
 
Obat Penggugur Kandungan Di Apotik Kimia Farma (087776558899)
Obat Penggugur Kandungan Di Apotik Kimia Farma (087776558899)Obat Penggugur Kandungan Di Apotik Kimia Farma (087776558899)
Obat Penggugur Kandungan Di Apotik Kimia Farma (087776558899)
 

07.Notifications & Reminder, Contact

  • 1. Notifications & Reminder, Contact Nguyen Tuan | Microsoft Certified Trainer
  • 2. Agenda  Tiles in Windows Phone 8  Local Tiles API  Updating Tiles from ShellTileSchedule  Updating Tiles from Background Agents  Lock screen notifications for Windows Phone  Lock screen background for Windows Phone
  • 3. Live Tiles • Windows phone has the unique ability to provide the end user glanceableaccess to the information they care most about, via Live Tiles • Push Notifications offer developers a way to send timely information to their applications even when they are not running • In Windows Phone 7.1 and later, the Local Tiles API allows apps to create and update tiles
  • 4. Live Tiles • Shortcuts to apps • All apps have at least one tile, known as the default tile • Created by user pinning your app to the Start Screen • Launch to app main page • Apps can create secondary tiles • Created programmatically • Launch to any page in your app • Static or dynamic • Tiles can be updated • Application code • Background agents • Push Notifications • In Windows Phone 7.1, only one tile size for third party apps • In Windows Phone 8.0, you can support three different tile sizes 4
  • 5. Tile Templates and Tile Sizes • Windows Phone 8 supports three Tile templates • Flip – flips from front to back (similar to the WP 7.1 Tile template) • Iconic – clean iconic layout designed to reflect Windows Phone design principles • Cycle – cycles through up to nine images 5
  • 6. Tile Content • The Tile content is built up from a fixed set of data properties • Data Properties for Text elements, Count elements and Image elements • Content that displays depends on the template you choose and the tile size • Not all elements need to be used • Not all elements used in all templates • WXGA resolution Image sizes • Automatically scaled for WVGA and 720p 6 Tile Size Flip and Cycle Images Iconic Images Small 159 x 159 pixels 159 x 159 pixels 110 x 110 pixels Medium 336 x 336 pixels 336 x 336 pixels 202 x 202 pixels Wide 691 x 336 pixels 691 x 336 pixels N/A
  • 7. Flip Tile Template • Flips from front to back • Small size does not flip • Medium size is the same as the WP7.1 tile template 8/16/2014 7
  • 8. Cycle Tile Template • Cycles between from 1 to 9 images • Small tile does not cycle 8/16/2014 8
  • 9. Iconic Tile Template • Displays a small image in the center of the Tile and is designed to reflect Windows Phone design principles 8/16/2014 9
  • 10. Primary and Secondary Tiles • Application Tile • Can be created only when user taps and holds the application name in the Application List and then selects pin to start • Tile template and Properties are set initially in the Application Manifest • Template cannot be changed programmatically • Secondary Tile • Can be created only as the result of user input in an application • The application then uses the Create(Uri, ShellTileData) method to createa Tile on Start • Because the UI will navigate to Start when a new secondary Tile is created, only one secondary Tile can be created at a time
  • 11. Defining the Application Tile • Define your images • The standard new project templates already contain placeholder images of the correct size • FlipCycleTile*.png used for the Flip and Cycle Tile templates • IconicTile*.png used for the Iconic Tile templates • Replace these images with your own artwork 8/16/2014 11
  • 12. Defining the Application Tile in the Application Manifest • Double-click WMAppManifest.xml to open using the new Manifest Editor • On the Application UI tab, set the Tile Template, optional Title and Tile Images 8/16/2014 12
  • 14. Creating and Updating Tiles with the Local Tile API • Localtileupdates(these are*not*push) • Fullcontrolofallproperties whenyourapp isintheforeground orbackground • ManageSecondaryTiles • Create/Update/Delete • Launchesdirectly topage/experience
  • 15. Creating Tiles public static void SetTile(RecipeDataItem item, string NavSource) { FlipTileData tileData = new FlipTileData() { //Front square data Title = item.Title, BackgroundImage = new Uri("ms-appx:///background1.png", UriKind.Relative), SmallBackgroundImage = new Uri("ms-appx:///smallbackground1.png", UriKind.Relative), //Back square data BackTitle = item.Title, BackContent = item.Ingredients, BackBackgroundImage = new Uri("ms-appx:///backbackground1.png", UriKind.Relative), //Wide tile data WideBackgroundImage = new Uri("ms-appx:///widebackground1.png", UriKind.Relative), WideBackBackgroundImage = new Uri("ms-appx:///widebackbackground1.png", UriKind.Relative), WideBackContent = item.Directions }; // Create Tile and pin it to Start. Causes a navigation to Start and a deactivation of our application ShellTile.Create(new Uri("/RecipePage.xaml?DefaultTitle=FromTile", UriKind.Relative), tileData, true); }
  • 16. Updating Tiles // Find the Tile we want to update. ShellTile TileToFind = ShellTile.ActiveTiles.FirstOrDefault( x => x.NavigationUri.ToString().Contains("DefaultTitle=FromTile")); // If the Tile was found, then update the Title. if (TileToFind != null) { FlipTileData NewTileData = new FlipTileData { Title = textBoxTitle.Text }; TileToFind.Update(NewTileData); }
  • 17. Updating the Application Tile public static void UpdateMainTile(RecipeDataGroup group) { //Get application's main tile – application tile always first item in the ActiveTiles collection //whether it is pinned or not var mainTile = ShellTile.ActiveTiles.FirstOrDefault(); IconicTileData tileData = new IconicTileData() { Count = group.RecipesCount, BackgroundColor = Color.FromArgb(255, 195, 61, 39), Title = "Contoso Cookbooks", IconImage = new Uri("ms-appx:///local/shared/shellcontent/newMedLogo.png", UriKind.RelativeOrAbsolute), SmallIconImage = new Uri("ms-appx:///local/shared/shellcontent/newSmlLogo.png", UriKind.RelativeOrAbsolute), WideContent1 = "Recent activity:", WideContent2 = "Browsed " + group.Title + " group", WideContent3 = "with total of " + group.RecipesCount + " recipes" }; mainTile.Update(tileData); }
  • 19. Updating Tiles with a Tile Schedule • Periodically updates the tile image without pushing message though • Can only update the image on the front of the tile • Updates images only from the web, not from the app local store • Sets up notification channel and binds it to a tile notification • Few limitations • Image size must be less than 150 KB (up from 80KB in WP7.1) • Download time must not exceed 45 seconds (up from 30 seconds in 7.1) • Lowest update time resolution is 60 minutes • If the schedule for an indefinite or finite number of updates fails too many times, OS will cancel it • Update recurrence can by Onetime, EveryHour, EveryDay, EveryWeek or EveryMonth 19
  • 20. Scheduling Tile Update 20 public partial class MainPage : PhoneApplicationPage { ShellTileSchedule SampleTileSchedule = new ShellTileSchedule(); private void buttonIndefinite_Click(object sender, RoutedEventArgs e) { // Updates will happen on a fixed interval. SampleTileSchedule.Recurrence = UpdateRecurrence.Interval; // Updates will happen every hour. // Because MaxUpdateCount is not set, the schedule will run indefinitely. SampleTileSchedule.Interval = UpdateInterval.EveryHour; SampleTileSchedule.RemoteImageUri = new Uri(@"http://www.weather.gov/forecasts/graphical/images/conus/MaxT1_conus.png"); // Updates will apply to the application tile. SampleTileSchedule.Start(); } }
  • 21. Scheduling Secondary Tile Updates 21 foreach (ShellTile TileToSchedule in ShellTile.ActiveTiles) { ShellTileSchedule mySchedule = new ShellTileSchedule(TileToSchedule); mySchedule.Interval = UpdateInterval.EveryHour; mySchedule.Recurrence = UpdateRecurrence.Interval; mySchedule.RemoteImageUri = imageURI; mySchedule.Start(); } • Can also schedule updates for secondary tiles by passing the ShellTile object into the ShellTileSchedule constructor
  • 22. Updating Tiles From a Background Agent • In Windows Phone OS 7.0, only way of updatingLive Tiles was from a Tile Schedule or from Push Notifications • Tile Schedule needs to fetch images from a web URI • Push Notifications require you to implement a backend service • To have control of shell tiles when the app is not running without using Push Notifications, a good solution is a Background Agent • Use the ShellTile API to locate and update tiles
  • 24. 8/16/2014 24 Lock screen notifications
  • 25. • End user can now select any app that has been enabled for lock screen notifications to show detailed status • Select any five apps to show quick status (icon and count) • For your app to be included in the notifications area, all you have to do is • Create an icon • Declare the app’s intent in the application manifest file 8/16/2014 25 Lock Screen on Windows Phone 8
  • 26. • Create a 24 x 24 pixel PNG image that will be used to identify your app on the lock screen •Contain only white pixels and transparent background • Default name is LockIcon.png •Use this name and you do not have to explicitly declare it in the application manifest • If you use another name, •Edit WMAppManifest.xml using the XML editor •Change the DeviceLockImageURI element which is listed inside the Tokens element: Creating a lock screen icon 8/16/2014 26 <Tokens> <PrimaryToken TokenID="PhoneApp4Token" TaskName="_default"> <TemplateFlip> … <DeviceLockImageURI>MyLockIcon.png</DeviceLockImageURI> </TemplateFlip> </PrimaryToken> </Tokens>
  • 27. • Edit WMAppManifest.xml with the XML editor •Find the <Extensions> element. If not there, create it immediately following the <Tokens> element. •Inside the <Extensions> element, create <Extension> elements for each feature you want to support: Icon Count and/or Text <Extensions> <Extension ExtensionName="LockScreen_Notification_IconCount" ConsumerID="{111DFF24-AA15-4A96-8006-2BFF8122084F}" TaskID="_default" /> <Extension ExtensionName="LockScreen_Notification_TextField" ConsumerID="{111DFF24-AA15-4A96-8006-2BFF8122084F}" TaskID="_default" /> </Extensions> Updating the Application Manifest File 8/16/2014 27
  • 28. • Lock Screen Icon Count and Text is taken directly from your applications primary tile • Secondary tiles are not used for this feature • Information is only displayed on the lock screen if the tile contains the information • For example, a count will only be displayed if the tile displays it • Primary tile does not need to be pinned to the Start Screen for lock screen notifications to be enabled • Update Primary Tile content in the usual way • LocalShell Tiles API • Push Notifications How to Update the Icon Count and Text 8/16/2014 28
  • 29. • Simulation Dashboard allows you to display the Lock Screen on the emulator • Access the Simulation Dashboard from the Visual Studio Tools menu Testing with the Simulation Dashboard 8/16/2014 29
  • 32. • End user can choose a background image from their own photos or search for an image on Bing • In addition, they can choose an app to be the background image provider • For your app to be a lock screen background provider, all you have to do is • Declare the app’s intent in the application manifest file • Write code to change the background image 8/16/2014 32 Lock Screen Background
  • 33. • Edit WMAppManifest.xml with the XML editor •Find the <Extensions> element. If not there, create it immediately following the <Tokens> element. •Inside the <Extensions> element, create an <Extension> element for LockScreen_Background <Extensions> <Extension ExtensionName="LockScreen_Background" ConsumerID="{111DFF24-AA15-4A96-8006-2BFF8122084F}" TaskID="_default" /> </Extensions> Updating the Application Manifest File 8/16/2014 33
  • 34. Write Code to Change the Lock Screen Background private async void lockHelper(Uri backgroundImageUri, string backgroundAction) { try { //If you're not the provider, this call will prompt the user for permission. //Calling RequestAccessAsync from a background agent is not allowed. var op = await LockScreenManager.RequestAccessAsync(); //Check the status to make sure we were given permission. bool isProvider = LockScreenManager.IsProvidedByCurrentApplication; if (isProvider) { //Do the update. Windows.Phone.System.UserProfile.LockScreen.SetImageUri(backgroundImageUri); System.Diagnostics.Debug.WriteLine("New current image set to {0}", backgroundImageUri.ToString()); } else { MessageBox.Show("You said no, so I can't update your background."); } } catch (System.Exception ex) { System.Diagnostics.Debug.WriteLine(ex.ToString()); } }
  • 35. • Call to LockScreenManager.RequestAccess Async is required •Checks if your app is already the selected lock screen background provider •If not, prompts user for permission to make your app the selected provider User Confirmation 8/16/2014 35 //If you're not the provider, this call will prompt the user for permission. //Calling RequestAccessAsync from a background agent is not allowed. var op = await LockScreenManager.RequestAccessAsync();
  • 36. • To use an image that you shipped in your app, use ms-appx:/// Uri imageUri = new Uri("ms-appx:///background1.png", UriKind.RelativeOrAbsolute); LockScreen.SetImageUri(imageUri); • To use an image stored in the Local Folder, use ms- appdata:///local/shared/shellcontent • Must be in or below the /shared/shellcontent subfolder Uri imageUri = new Uri("ms- appdata:///local/shared/shellcontent/background2.png", UriKind.RelativeOrAbsolute); LockScreen.SetImageUri(imageUri); Accessing Local Images 8/16/2014 36
  • 38. Summary • Shell Tile API allows easy manipulation of tiles from within an application • Tiles can have a front and a back, and apps can have secondary tiles • Tiles and Toasts can launch into a specific page within the app • Only the user can decide to pin an apps’ primary tile to the Start Screen, not from code • App can declare in the App manifest that it can be a lock screen notification provider • User must select apps to display lock screen notifications from phone Settings • Optionally supply count and/or text – these are pulled directly from the primary tile • App can also declare that it can be a lock screen background provider • Code used to request permission from the user and to change the lock screen background