SlideShare una empresa de Scribd logo
1 de 28
Oliver Scheer
Senior Technical Evangelist
Microsoft Deutschland
http://the-oliver.com
File and Protocol
Associations
This App   This App
Agenda
3/18/2014Microsoft confidential2
Launching Apps to Handle
Particular File Types
Launching one App from
Another
Auto-Launching with File and Protocol
Associations
Automatically launch your app when another app launches a
particular file type or protocol
File associations allow your app to launch to handle an email
attachment, a file opened in Internet Explorer or by another
app
• File associations allow your app to launch when the user wants to open a particular file
type, via:
• an email attachment
• a website via Internet Explorer
• a text message
• a Near Field Communications (NFC) tag
• another app from the Store
• Protocol association allows your app to automatically launch when another app launches a
special URI
• Protocol is the first part of a URI, e.g. myprotocol:/ShowProducts?CategoryID=aea6ae1f
• Your app launches another and passes it data in the remainder of the launch URI
Auto-launching with File and Protocol Associations
3/18/2014Microsoft confidential3
• When a user launches a file or protocol from an app
• If there is only one app on the phone registered for that file or
protocol, the app is automatically launched
• If there is more than one app registered for that file or
protocol, the user is asked which app they want to use
• If no apps on the phone can handle that file or protocol, the
user is given the option to get one that does
User Experience with File and Protocol Associations
3/18/2014Microsoft confidential4
• Like Windows 8, Windows Phone 8 uses
Launcher.LaunchFileAsync(IStorageFile) to launch a file and
Launcher.LaunchUriAsync(Uri) to launch a URI
• However, the way Windows Phone XAML apps receive a file or
URI is different
• Windows 8 has a “default” Store app for a file type or URI, so that
will be launched
• In Windows Phone 8, if there are multiple Store apps installed that
can handle a particular file or protocol association, the user
chooses the receiving app from a menu
Comparison with Windows 8 User Experience
3/18/2014Microsoft confidential5
File Associations
3/18/2014Microsoft confidential7
• To handle a particular file type, register for a file association in the app manifest file
• Optionally supply logos that Windows Phone OS will use when listing files
• Edit WMAppManifest.xml using the XML (Text) Editor
Registering for a File Association
3/18/2014Microsoft confidential8
Logo Size Use Dimensions
Small Email attachments 33x33 pixels
Medium Office hub list view 69x69 pixels
Large Browser download 176x176 pixels
• Add a FileTypeAssociation element inside the Extensions element
• The Extensions element must follow immediately after the Tokens element
• Specify up to 20 file extensions per file type association
<Extensions>
<FileTypeAssociation Name="BugQuery" TaskID="_default" NavUriFragment="fileToken=%s">
<Logos>
<Logo Size="small">bug-small-33x33.png</Logo>
<Logo Size="medium">bug-medium-69x69.png</Logo>
<Logo Size="large">bug-large-176x176.png</Logo>
</Logos>
<SupportedFileTypes>
<FileType>.bqy</FileType>
</SupportedFileTypes>
</FileTypeAssociation>
</Extensions>
Adding a File Association to WMAppManifest.xml
3/18/2014Microsoft confidential9
• When your app is launched to handle a file, a deep link URI is sent to your app
/FileTypeAssociation?fileToken=89819279-4fe0-4531-9f57-d633f0949a19
• You need to implement a custom URI Mapper to parse the deep link URI and map to a
page in your app that will handle it
Listening for a file launch
3/18/2014Microsoft confidential10
FileTypeAssociation designates
that the source of the URI is a file type
association
The file token
Custom URI Mapper - 1
using System;
using System.Windows.Navigation;
using Windows.Phone.Storage.SharedAccess;
namespace FileAssociationsHandler
{
class AssociationUriMapper : UriMapperBase
{
private string tempUri;
public override Uri MapUri(Uri uri)
{
tempUri = uri.ToString();
// File association launch
if (tempUri.Contains("/FileTypeAssociation"))
{
// Get the file ID (after "fileToken=").
int fileIDIndex = tempUri.IndexOf("fileToken=") + 10;
string fileID = tempUri.Substring(fileIDIndex);
// Get the file name.
string incomingFileName =
SharedStorageAccessManager.GetSharedFileName(fileID);
...
Custom URI Mapper - 2
...
// Get the file extension.
int extensionIndex = incomingFileName.LastIndexOf('.') + 1;
string incomingFileType =
incomingFileName.Substring(extensionIndex).ToLower();
// Map the .bqy and .bdp files to the appropriate pages.
switch (incomingFileType)
{
case "bqy":
return new Uri("/BugQueryPage.xaml?fileToken=" + fileID, UriKind.Relative);
case "bdp":
return new Uri("/BugDetailPage.xaml?fileToken=" + fileID, UriKind.Relative);
default:
return new Uri("/MainPage.xaml", UriKind.Relative);
}
}
// Map everything else to the main page.
return new Uri("/MainPage.xaml", UriKind.Relative);
}
}
}
Using the URI Mapper
private void InitializePhoneApplication()
{
if (phoneApplicationInitialized)
return;
// Create the frame but don't set it as RootVisual yet; this allows the splash
// screen to remain active until the application is ready to render.
RootFrame = new PhoneApplicationFrame();
RootFrame.Navigated += CompleteInitializePhoneApplication;
// Assign the URI-mapper class to the application frame.
RootFrame.UriMapper = new AssociationUriMapper();
// Handle navigation failures
RootFrame.NavigationFailed += RootFrame_NavigationFailed;
// Handle reset requests for clearing the backstack
RootFrame.Navigated += CheckForResetNavigation;
// Ensure we don't initialize again
phoneApplicationInitialized = true;
}
• Assign the custom URI Mapper to the root frame of the app in App.xaml.cs
Local Storage
SharedStorage
• Files passed to an app are stored by the OS
in a special folder called SharedStorage
• Receiving apps only have read access to
this folder
• Copy file to local storage to access it
Accessing the File
3/18/201414
Retrieving the File
protected async override void OnNavigatedTo(NavigationEventArgs e)
{
// Get a dictionary of URI parameters and values.
IDictionary<string, string> queryStrings = this.NavigationContext.QueryString;
// Have we been launched to handle a file association?
if (queryStrings.ContainsKey("fileToken"))
{
// Yes we have - get the file token
string fileToken = queryStrings["fileToken"];
// Copy the file from shared storage
string filename = SharedStorageAccessManager.GetSharedFileName(fileToken);
IStorageFile bugQueryFile = await SharedStorageAccessManager.CopySharedFileAsync(
ApplicationData.Current.LocalFolder, // Store in the local folder
filename, // keep the same filename
NameCollisionOption.ReplaceExisting, // Replace any existing file of the same name
fileToken);
// Do something with the file...
}
...
}
• Use the SharedStorageAccessManager.GetSharedFileName and
SharedStorageAccessManager.CopySharedFileAsync methods to access the file
• Your app can launch a file so another app can open it
Sending a File to Another App
3/18/201416
private async void LaunchFileButton_Click(object sender, RoutedEventArgs rea)
{
// Access local storage.
StorageFolder local = Windows.Storage.ApplicationData.Current.LocalFolder;
// Access the bug query file.
StorageFile bqfile = await local.GetFileAsync("file1.bqy");
// Launch the bug query file.
Windows.System.Launcher.LaunchFileAsync(bqfile);
}
• Many file extensions are reserved for the built-in apps
• .cer, .doc, .docx, .jpg, .mp3, .pptx … etc..
• Many more reserved by the OS
• .ade, .adp ….[ > 100 in total! ] … .xnk
• If you try to reserve a file association using one of the reserved types, the reservation
request will be ignored
• See the documentation for a full list of the reserved file types
Reserved File Associations
3/18/2014Microsoft confidential17
Protocol
Associations
3/18/2014Microsoft confidential19
• Protocol association allows your app to automatically launch when another app launches a
special URI
• The URI begins with a protocol name that your app has registered for
• For example, contoso is the protocol name in the following URI:
contoso:ShowProducts?CategoryID=aea6ae1f-9894-404e-8bca-ec47ec5b9c6c
• After the colon, the rest of the URI can be set to whatever you want
Protocol Associations
3/18/2014Microsoft confidential20
• To register your app for a protocol association, add a Protocol element inside the Extensions
element
• The Extensions element must follow immediately after the Tokens element
• Maximum of 10 protocol associations per app
<Extensions>
<Protocol Name=“contoso" TaskID="_default" NavUriFragment=“encodedLaunchUri=%s">
</Extensions>
Adding a Protocol Association to WMAppManifest.xml
3/18/2014Microsoft confidential21
• When your app is launched to handle a protocol association, a deep link URI is sent to
your app
/Protocol?encodedLaunchUri=contoso:ShowProducts?CategoryID=aea6ae1f
• Implement a custom URI Mapper to parse the deep link URI and map to a page in your
app that will handle it, same as for File Associations
Listening for a URI
3/18/2014Microsoft confidential22
Protocol designates that the source
of the URI is a protocol association
The full encoded launch URI
• Use the LaunchUriAsync method to launch another app that is registered for that protocol
Launching a URI
3/18/201423
private void Button_Click_1(object sender, RoutedEventArgs e)
{
// Launch a protocol
Windows.System.Launcher.LaunchUriAsync(new Uri("jumpstart:NewSession"));
}
• Some protocols are reserved for the built-in apps
• http:, MailTo:, Map:
• Many more reserved by the OS
• File:, Iehistory:, Javascript:, … many more…
• If you try to reserve a protocol association using one of the reserved protocols, the
reservation request will be ignored
• See the documentation for a full list of the reserved protocols
Reserved Protocol Associations
3/18/2014Microsoft confidential24
URI scheme Description
http:[URL]
Launches the web browser and navigates to the specified
URL.
mailto:[email address]
Launches the email app and creates a new message with the
specified email address on the To line.
Note that the email is not sent until the user taps send.
ms-settings-accounts: Launches the Account Settings app.
ms-settings-airplanemode: Launches the Airplane Mode Settings app.
ms-settings-bluetooth: Launches the Bluetooth Settings app.
ms-settings-cellular: Launches the Cellular Settings app.
ms-settings-emailandaccounts: Launches the email and accounts settings app.
ms-settings-location: Launches the Location Settings app.
ms-settings-lock: Launches the Lock Screen settings app.
ms-settings-wifi: Launches the Wi-Fi Settings app.
Launching Built-in Apps
Use LaunchUriAsync to launch many of the built-in apps
3/18/2014Microsoft confidential25
Launching Built-in Apps (cont)
3/18/2014Microsoft confidential26
URI scheme Description
zune:navigate?appid=[app ID]
Launches the Windows Phone Store and shows the details
page for the specified app.
zune:reviewapp
Launches the Store and shows the review page for the
calling app.
zune:reviewapp?appid=[app ID]
Launches the Store and shows the review page for the
specified app.
zune:search?[search parameter]=[value] Launches the Store and searches for the specified content.
zune:search?keyword=[search keyword]
&contenttype=app
Launches the Store and searches for apps by keyword.
zune:search?publisher=[publisher name]
Launches the Store and searches for items by publisher
name.
• App can register to handle particular file types
• When the user opens a file from a website, email message or SMS message, your app is
launched to process the file
• One app can launch another by launching a file of a type for which the second app has
registered a file association
• App can register for an association with particular URI protocols
• One app can launch another by launching a URI using a protocol for which the second app
has registered a protocol association
• If more than one app has registered the same file or protocol association, the user is asked
to select which app should be launched
Summary
3/18/2014
The information herein is for informational
purposes only an represents the current view of
Microsoft Corporation as of the date of this
presentation. Because Microsoft must respond
to changing market conditions, it should not be
interpreted to be a commitment on the part of
Microsoft, and Microsoft cannot guarantee the
accuracy of any information provided after the
date of this presentation.
© 2012 Microsoft Corporation.
All rights reserved. Microsoft, Windows, Windows Vista and other product names are or may be registered trademarks and/or trademarks in the U.S. and/or other countries.
MICROSOFT MAKES NO WARRANTIES, EXPRESS, IMPLIED OR STATUTORY, AS TO THE INFORMATION
IN THIS PRESENTATION.

Más contenido relacionado

La actualidad más candente

Full Text Search with Lucene
Full Text Search with LuceneFull Text Search with Lucene
Full Text Search with Lucene
WO Community
 
File protection.59 to 60
File protection.59 to 60File protection.59 to 60
File protection.59 to 60
myrajendra
 

La actualidad más candente (12)

Io files and web
Io files and webIo files and web
Io files and web
 
yii1
yii1yii1
yii1
 
File Protection
File ProtectionFile Protection
File Protection
 
Windows Registry
Windows RegistryWindows Registry
Windows Registry
 
Windows Registry Analysis
Windows Registry AnalysisWindows Registry Analysis
Windows Registry Analysis
 
Tutorial 5 (lucene)
Tutorial 5 (lucene)Tutorial 5 (lucene)
Tutorial 5 (lucene)
 
Memory management
Memory managementMemory management
Memory management
 
Full Text Search with Lucene
Full Text Search with LuceneFull Text Search with Lucene
Full Text Search with Lucene
 
Indexing Text and HTML Files with Solr
Indexing Text and HTML Files with SolrIndexing Text and HTML Files with Solr
Indexing Text and HTML Files with Solr
 
file management
file managementfile management
file management
 
Examining Mac File Structures
Examining Mac File StructuresExamining Mac File Structures
Examining Mac File Structures
 
File protection.59 to 60
File protection.59 to 60File protection.59 to 60
File protection.59 to 60
 

Similar a Windows Phone 8 - 11 App to App Communication

Александр Краковецкий_Разработка универсальных приложений для Windows Phone 8...
Александр Краковецкий_Разработка универсальных приложений для Windows Phone 8...Александр Краковецкий_Разработка универсальных приложений для Windows Phone 8...
Александр Краковецкий_Разработка универсальных приложений для Windows Phone 8...
GeeksLab Odessa
 
WP7 HUB_Creando aplicaciones de Windows Phone
WP7 HUB_Creando aplicaciones de Windows PhoneWP7 HUB_Creando aplicaciones de Windows Phone
WP7 HUB_Creando aplicaciones de Windows Phone
MICTT Palma
 
Android datastorage
Android datastorageAndroid datastorage
Android datastorage
Krazy Koder
 
3.1 file input and output
3.1   file input and output3.1   file input and output
3.1 file input and output
allenbailey
 
how to connect your app to the activity stream with x-pages
how to connect your app to the activity stream with x-pageshow to connect your app to the activity stream with x-pages
how to connect your app to the activity stream with x-pages
Frank van der Linden
 
Firefox security (prasanna)
Firefox security (prasanna) Firefox security (prasanna)
Firefox security (prasanna)
ClubHack
 
Lesson 4 - Managing Applications, Services, Folders, and Libraries
Lesson 4 - Managing Applications, Services, Folders, and LibrariesLesson 4 - Managing Applications, Services, Folders, and Libraries
Lesson 4 - Managing Applications, Services, Folders, and Libraries
Gene Carboni
 
Jsr75 sup
Jsr75 supJsr75 sup
Jsr75 sup
SMIJava
 

Similar a Windows Phone 8 - 11 App to App Communication (20)

Александр Краковецкий_Разработка универсальных приложений для Windows Phone 8...
Александр Краковецкий_Разработка универсальных приложений для Windows Phone 8...Александр Краковецкий_Разработка универсальных приложений для Windows Phone 8...
Александр Краковецкий_Разработка универсальных приложений для Windows Phone 8...
 
Android session 4-behestee
Android session 4-behesteeAndroid session 4-behestee
Android session 4-behestee
 
Level 4
Level 4Level 4
Level 4
 
File Handling
File HandlingFile Handling
File Handling
 
File Handling
File HandlingFile Handling
File Handling
 
WP7 HUB_Creando aplicaciones de Windows Phone
WP7 HUB_Creando aplicaciones de Windows PhoneWP7 HUB_Creando aplicaciones de Windows Phone
WP7 HUB_Creando aplicaciones de Windows Phone
 
Android datastorage
Android datastorageAndroid datastorage
Android datastorage
 
File Protection
File ProtectionFile Protection
File Protection
 
Chapter4.pptx
Chapter4.pptxChapter4.pptx
Chapter4.pptx
 
File Handling In C++
File Handling In C++File Handling In C++
File Handling In C++
 
Advance Mobile Application Development class 02-B
Advance Mobile Application Development class 02-BAdvance Mobile Application Development class 02-B
Advance Mobile Application Development class 02-B
 
3.1 file input and output
3.1   file input and output3.1   file input and output
3.1 file input and output
 
Storage Made Easy - File Fabric Use Cases
Storage Made Easy - File Fabric Use CasesStorage Made Easy - File Fabric Use Cases
Storage Made Easy - File Fabric Use Cases
 
SANS Windows Artifact Analysis 2012
SANS Windows Artifact Analysis 2012SANS Windows Artifact Analysis 2012
SANS Windows Artifact Analysis 2012
 
No need to leave Connections. Bring your Domino applications into the Activit...
No need to leave Connections. Bring your Domino applications into the Activit...No need to leave Connections. Bring your Domino applications into the Activit...
No need to leave Connections. Bring your Domino applications into the Activit...
 
how to connect your app to the activity stream with x-pages
how to connect your app to the activity stream with x-pageshow to connect your app to the activity stream with x-pages
how to connect your app to the activity stream with x-pages
 
10 sharing files and data in windows phone 8
10   sharing files and data in windows phone 810   sharing files and data in windows phone 8
10 sharing files and data in windows phone 8
 
Firefox security (prasanna)
Firefox security (prasanna) Firefox security (prasanna)
Firefox security (prasanna)
 
Lesson 4 - Managing Applications, Services, Folders, and Libraries
Lesson 4 - Managing Applications, Services, Folders, and LibrariesLesson 4 - Managing Applications, Services, Folders, and Libraries
Lesson 4 - Managing Applications, Services, Folders, and Libraries
 
Jsr75 sup
Jsr75 supJsr75 sup
Jsr75 sup
 

Más de Oliver Scheer

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
Oliver Scheer
 
Windows Phone 8 - 16 Wallet and In-app Purchase
Windows Phone 8 - 16 Wallet and In-app PurchaseWindows Phone 8 - 16 Wallet and In-app Purchase
Windows Phone 8 - 16 Wallet and In-app Purchase
Oliver Scheer
 
Windows Phone 8 - 15 Location and Maps
Windows Phone 8 - 15 Location and MapsWindows Phone 8 - 15 Location and Maps
Windows Phone 8 - 15 Location and Maps
Oliver Scheer
 
Windows Phone 8 - 14 Using Speech
Windows Phone 8 - 14 Using SpeechWindows Phone 8 - 14 Using Speech
Windows Phone 8 - 14 Using Speech
Oliver Scheer
 
Windows Phone 8 - 13 Near Field Communcations and Bluetooth
Windows Phone 8 - 13 Near Field Communcations and BluetoothWindows Phone 8 - 13 Near Field Communcations and Bluetooth
Windows Phone 8 - 13 Near Field Communcations and Bluetooth
Oliver Scheer
 
Windows Phone 8 - 12 Network Communication
Windows Phone 8 - 12 Network CommunicationWindows Phone 8 - 12 Network Communication
Windows Phone 8 - 12 Network Communication
Oliver Scheer
 
Windows Phone 8 - 10 Using Phone Resources
Windows Phone 8 - 10 Using Phone ResourcesWindows Phone 8 - 10 Using Phone Resources
Windows Phone 8 - 10 Using Phone Resources
Oliver Scheer
 
Windows Phone 8 - 9 Push Notifications
Windows Phone 8 - 9 Push NotificationsWindows Phone 8 - 9 Push Notifications
Windows Phone 8 - 9 Push Notifications
Oliver Scheer
 
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
Oliver Scheer
 
Windows Phone 8 - 7 Local Database
Windows Phone 8 - 7 Local DatabaseWindows Phone 8 - 7 Local Database
Windows Phone 8 - 7 Local Database
Oliver Scheer
 
Windows Phone 8 - 6 Background Agents
Windows Phone 8 - 6 Background AgentsWindows Phone 8 - 6 Background Agents
Windows Phone 8 - 6 Background Agents
Oliver Scheer
 
Windows Phone 8 - 5 Application Lifecycle
Windows Phone 8 - 5 Application LifecycleWindows Phone 8 - 5 Application Lifecycle
Windows Phone 8 - 5 Application Lifecycle
Oliver Scheer
 
Windows Phone 8 - 4 Files and Storage
Windows Phone 8 - 4 Files and StorageWindows Phone 8 - 4 Files and Storage
Windows Phone 8 - 4 Files and Storage
Oliver Scheer
 
Windows Phone 8 - 3.5 Async Programming
Windows Phone 8 - 3.5 Async ProgrammingWindows Phone 8 - 3.5 Async Programming
Windows Phone 8 - 3.5 Async Programming
Oliver Scheer
 
Windows Phone 8 - 1 Introducing Windows Phone 8 Development
Windows Phone 8 - 1 Introducing Windows Phone 8 DevelopmentWindows Phone 8 - 1 Introducing Windows Phone 8 Development
Windows Phone 8 - 1 Introducing Windows Phone 8 Development
Oliver Scheer
 
Windows Phone 8 - 3 Building WP8 Applications
Windows Phone 8 - 3 Building WP8 ApplicationsWindows Phone 8 - 3 Building WP8 Applications
Windows Phone 8 - 3 Building WP8 Applications
Oliver Scheer
 
Windows Phone 8 - 2 Designing WP8 Applications
Windows Phone 8 - 2 Designing WP8 ApplicationsWindows Phone 8 - 2 Designing WP8 Applications
Windows Phone 8 - 2 Designing WP8 Applications
Oliver Scheer
 

Más de Oliver Scheer (17)

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
 
Windows Phone 8 - 16 Wallet and In-app Purchase
Windows Phone 8 - 16 Wallet and In-app PurchaseWindows Phone 8 - 16 Wallet and In-app Purchase
Windows Phone 8 - 16 Wallet and In-app Purchase
 
Windows Phone 8 - 15 Location and Maps
Windows Phone 8 - 15 Location and MapsWindows Phone 8 - 15 Location and Maps
Windows Phone 8 - 15 Location and Maps
 
Windows Phone 8 - 14 Using Speech
Windows Phone 8 - 14 Using SpeechWindows Phone 8 - 14 Using Speech
Windows Phone 8 - 14 Using Speech
 
Windows Phone 8 - 13 Near Field Communcations and Bluetooth
Windows Phone 8 - 13 Near Field Communcations and BluetoothWindows Phone 8 - 13 Near Field Communcations and Bluetooth
Windows Phone 8 - 13 Near Field Communcations and Bluetooth
 
Windows Phone 8 - 12 Network Communication
Windows Phone 8 - 12 Network CommunicationWindows Phone 8 - 12 Network Communication
Windows Phone 8 - 12 Network Communication
 
Windows Phone 8 - 10 Using Phone Resources
Windows Phone 8 - 10 Using Phone ResourcesWindows Phone 8 - 10 Using Phone Resources
Windows Phone 8 - 10 Using Phone Resources
 
Windows Phone 8 - 9 Push Notifications
Windows Phone 8 - 9 Push NotificationsWindows Phone 8 - 9 Push Notifications
Windows Phone 8 - 9 Push Notifications
 
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 - 7 Local Database
Windows Phone 8 - 7 Local DatabaseWindows Phone 8 - 7 Local Database
Windows Phone 8 - 7 Local Database
 
Windows Phone 8 - 6 Background Agents
Windows Phone 8 - 6 Background AgentsWindows Phone 8 - 6 Background Agents
Windows Phone 8 - 6 Background Agents
 
Windows Phone 8 - 5 Application Lifecycle
Windows Phone 8 - 5 Application LifecycleWindows Phone 8 - 5 Application Lifecycle
Windows Phone 8 - 5 Application Lifecycle
 
Windows Phone 8 - 4 Files and Storage
Windows Phone 8 - 4 Files and StorageWindows Phone 8 - 4 Files and Storage
Windows Phone 8 - 4 Files and Storage
 
Windows Phone 8 - 3.5 Async Programming
Windows Phone 8 - 3.5 Async ProgrammingWindows Phone 8 - 3.5 Async Programming
Windows Phone 8 - 3.5 Async Programming
 
Windows Phone 8 - 1 Introducing Windows Phone 8 Development
Windows Phone 8 - 1 Introducing Windows Phone 8 DevelopmentWindows Phone 8 - 1 Introducing Windows Phone 8 Development
Windows Phone 8 - 1 Introducing Windows Phone 8 Development
 
Windows Phone 8 - 3 Building WP8 Applications
Windows Phone 8 - 3 Building WP8 ApplicationsWindows Phone 8 - 3 Building WP8 Applications
Windows Phone 8 - 3 Building WP8 Applications
 
Windows Phone 8 - 2 Designing WP8 Applications
Windows Phone 8 - 2 Designing WP8 ApplicationsWindows Phone 8 - 2 Designing WP8 Applications
Windows Phone 8 - 2 Designing WP8 Applications
 

Último

Architecting Cloud Native Applications
Architecting Cloud Native ApplicationsArchitecting Cloud Native Applications
Architecting Cloud Native Applications
WSO2
 
Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Finding Java's Hidden Performance Traps @ DevoxxUK 2024Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Victor Rentea
 
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Victor Rentea
 
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Safe Software
 
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Safe Software
 

Último (20)

Architecting Cloud Native Applications
Architecting Cloud Native ApplicationsArchitecting Cloud Native Applications
Architecting Cloud Native Applications
 
ICT role in 21st century education and its challenges
ICT role in 21st century education and its challengesICT role in 21st century education and its challenges
ICT role in 21st century education and its challenges
 
Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Finding Java's Hidden Performance Traps @ DevoxxUK 2024Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Finding Java's Hidden Performance Traps @ DevoxxUK 2024
 
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
 
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
 
Rising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdf
Rising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdfRising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdf
Rising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdf
 
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
 
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected Worker
 
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
 
Artificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : UncertaintyArtificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : Uncertainty
 
Introduction to Multilingual Retrieval Augmented Generation (RAG)
Introduction to Multilingual Retrieval Augmented Generation (RAG)Introduction to Multilingual Retrieval Augmented Generation (RAG)
Introduction to Multilingual Retrieval Augmented Generation (RAG)
 
Elevate Developer Efficiency & build GenAI Application with Amazon Q​
Elevate Developer Efficiency & build GenAI Application with Amazon Q​Elevate Developer Efficiency & build GenAI Application with Amazon Q​
Elevate Developer Efficiency & build GenAI Application with Amazon Q​
 
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
 
FWD Group - Insurer Innovation Award 2024
FWD Group - Insurer Innovation Award 2024FWD Group - Insurer Innovation Award 2024
FWD Group - Insurer Innovation Award 2024
 
Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...
 
MS Copilot expands with MS Graph connectors
MS Copilot expands with MS Graph connectorsMS Copilot expands with MS Graph connectors
MS Copilot expands with MS Graph connectors
 
CNIC Information System with Pakdata Cf In Pakistan
CNIC Information System with Pakdata Cf In PakistanCNIC Information System with Pakdata Cf In Pakistan
CNIC Information System with Pakdata Cf In Pakistan
 
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data DiscoveryTrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
 
Polkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin WoodPolkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin Wood
 

Windows Phone 8 - 11 App to App Communication

  • 1. Oliver Scheer Senior Technical Evangelist Microsoft Deutschland http://the-oliver.com File and Protocol Associations This App   This App
  • 2. Agenda 3/18/2014Microsoft confidential2 Launching Apps to Handle Particular File Types Launching one App from Another Auto-Launching with File and Protocol Associations Automatically launch your app when another app launches a particular file type or protocol File associations allow your app to launch to handle an email attachment, a file opened in Internet Explorer or by another app
  • 3. • File associations allow your app to launch when the user wants to open a particular file type, via: • an email attachment • a website via Internet Explorer • a text message • a Near Field Communications (NFC) tag • another app from the Store • Protocol association allows your app to automatically launch when another app launches a special URI • Protocol is the first part of a URI, e.g. myprotocol:/ShowProducts?CategoryID=aea6ae1f • Your app launches another and passes it data in the remainder of the launch URI Auto-launching with File and Protocol Associations 3/18/2014Microsoft confidential3
  • 4. • When a user launches a file or protocol from an app • If there is only one app on the phone registered for that file or protocol, the app is automatically launched • If there is more than one app registered for that file or protocol, the user is asked which app they want to use • If no apps on the phone can handle that file or protocol, the user is given the option to get one that does User Experience with File and Protocol Associations 3/18/2014Microsoft confidential4
  • 5. • Like Windows 8, Windows Phone 8 uses Launcher.LaunchFileAsync(IStorageFile) to launch a file and Launcher.LaunchUriAsync(Uri) to launch a URI • However, the way Windows Phone XAML apps receive a file or URI is different • Windows 8 has a “default” Store app for a file type or URI, so that will be launched • In Windows Phone 8, if there are multiple Store apps installed that can handle a particular file or protocol association, the user chooses the receiving app from a menu Comparison with Windows 8 User Experience 3/18/2014Microsoft confidential5
  • 6.
  • 8. • To handle a particular file type, register for a file association in the app manifest file • Optionally supply logos that Windows Phone OS will use when listing files • Edit WMAppManifest.xml using the XML (Text) Editor Registering for a File Association 3/18/2014Microsoft confidential8 Logo Size Use Dimensions Small Email attachments 33x33 pixels Medium Office hub list view 69x69 pixels Large Browser download 176x176 pixels
  • 9. • Add a FileTypeAssociation element inside the Extensions element • The Extensions element must follow immediately after the Tokens element • Specify up to 20 file extensions per file type association <Extensions> <FileTypeAssociation Name="BugQuery" TaskID="_default" NavUriFragment="fileToken=%s"> <Logos> <Logo Size="small">bug-small-33x33.png</Logo> <Logo Size="medium">bug-medium-69x69.png</Logo> <Logo Size="large">bug-large-176x176.png</Logo> </Logos> <SupportedFileTypes> <FileType>.bqy</FileType> </SupportedFileTypes> </FileTypeAssociation> </Extensions> Adding a File Association to WMAppManifest.xml 3/18/2014Microsoft confidential9
  • 10. • When your app is launched to handle a file, a deep link URI is sent to your app /FileTypeAssociation?fileToken=89819279-4fe0-4531-9f57-d633f0949a19 • You need to implement a custom URI Mapper to parse the deep link URI and map to a page in your app that will handle it Listening for a file launch 3/18/2014Microsoft confidential10 FileTypeAssociation designates that the source of the URI is a file type association The file token
  • 11. Custom URI Mapper - 1 using System; using System.Windows.Navigation; using Windows.Phone.Storage.SharedAccess; namespace FileAssociationsHandler { class AssociationUriMapper : UriMapperBase { private string tempUri; public override Uri MapUri(Uri uri) { tempUri = uri.ToString(); // File association launch if (tempUri.Contains("/FileTypeAssociation")) { // Get the file ID (after "fileToken="). int fileIDIndex = tempUri.IndexOf("fileToken=") + 10; string fileID = tempUri.Substring(fileIDIndex); // Get the file name. string incomingFileName = SharedStorageAccessManager.GetSharedFileName(fileID); ...
  • 12. Custom URI Mapper - 2 ... // Get the file extension. int extensionIndex = incomingFileName.LastIndexOf('.') + 1; string incomingFileType = incomingFileName.Substring(extensionIndex).ToLower(); // Map the .bqy and .bdp files to the appropriate pages. switch (incomingFileType) { case "bqy": return new Uri("/BugQueryPage.xaml?fileToken=" + fileID, UriKind.Relative); case "bdp": return new Uri("/BugDetailPage.xaml?fileToken=" + fileID, UriKind.Relative); default: return new Uri("/MainPage.xaml", UriKind.Relative); } } // Map everything else to the main page. return new Uri("/MainPage.xaml", UriKind.Relative); } } }
  • 13. Using the URI Mapper private void InitializePhoneApplication() { if (phoneApplicationInitialized) return; // Create the frame but don't set it as RootVisual yet; this allows the splash // screen to remain active until the application is ready to render. RootFrame = new PhoneApplicationFrame(); RootFrame.Navigated += CompleteInitializePhoneApplication; // Assign the URI-mapper class to the application frame. RootFrame.UriMapper = new AssociationUriMapper(); // Handle navigation failures RootFrame.NavigationFailed += RootFrame_NavigationFailed; // Handle reset requests for clearing the backstack RootFrame.Navigated += CheckForResetNavigation; // Ensure we don't initialize again phoneApplicationInitialized = true; } • Assign the custom URI Mapper to the root frame of the app in App.xaml.cs
  • 14. Local Storage SharedStorage • Files passed to an app are stored by the OS in a special folder called SharedStorage • Receiving apps only have read access to this folder • Copy file to local storage to access it Accessing the File 3/18/201414
  • 15. Retrieving the File protected async override void OnNavigatedTo(NavigationEventArgs e) { // Get a dictionary of URI parameters and values. IDictionary<string, string> queryStrings = this.NavigationContext.QueryString; // Have we been launched to handle a file association? if (queryStrings.ContainsKey("fileToken")) { // Yes we have - get the file token string fileToken = queryStrings["fileToken"]; // Copy the file from shared storage string filename = SharedStorageAccessManager.GetSharedFileName(fileToken); IStorageFile bugQueryFile = await SharedStorageAccessManager.CopySharedFileAsync( ApplicationData.Current.LocalFolder, // Store in the local folder filename, // keep the same filename NameCollisionOption.ReplaceExisting, // Replace any existing file of the same name fileToken); // Do something with the file... } ... } • Use the SharedStorageAccessManager.GetSharedFileName and SharedStorageAccessManager.CopySharedFileAsync methods to access the file
  • 16. • Your app can launch a file so another app can open it Sending a File to Another App 3/18/201416 private async void LaunchFileButton_Click(object sender, RoutedEventArgs rea) { // Access local storage. StorageFolder local = Windows.Storage.ApplicationData.Current.LocalFolder; // Access the bug query file. StorageFile bqfile = await local.GetFileAsync("file1.bqy"); // Launch the bug query file. Windows.System.Launcher.LaunchFileAsync(bqfile); }
  • 17. • Many file extensions are reserved for the built-in apps • .cer, .doc, .docx, .jpg, .mp3, .pptx … etc.. • Many more reserved by the OS • .ade, .adp ….[ > 100 in total! ] … .xnk • If you try to reserve a file association using one of the reserved types, the reservation request will be ignored • See the documentation for a full list of the reserved file types Reserved File Associations 3/18/2014Microsoft confidential17
  • 18.
  • 20. • Protocol association allows your app to automatically launch when another app launches a special URI • The URI begins with a protocol name that your app has registered for • For example, contoso is the protocol name in the following URI: contoso:ShowProducts?CategoryID=aea6ae1f-9894-404e-8bca-ec47ec5b9c6c • After the colon, the rest of the URI can be set to whatever you want Protocol Associations 3/18/2014Microsoft confidential20
  • 21. • To register your app for a protocol association, add a Protocol element inside the Extensions element • The Extensions element must follow immediately after the Tokens element • Maximum of 10 protocol associations per app <Extensions> <Protocol Name=“contoso" TaskID="_default" NavUriFragment=“encodedLaunchUri=%s"> </Extensions> Adding a Protocol Association to WMAppManifest.xml 3/18/2014Microsoft confidential21
  • 22. • When your app is launched to handle a protocol association, a deep link URI is sent to your app /Protocol?encodedLaunchUri=contoso:ShowProducts?CategoryID=aea6ae1f • Implement a custom URI Mapper to parse the deep link URI and map to a page in your app that will handle it, same as for File Associations Listening for a URI 3/18/2014Microsoft confidential22 Protocol designates that the source of the URI is a protocol association The full encoded launch URI
  • 23. • Use the LaunchUriAsync method to launch another app that is registered for that protocol Launching a URI 3/18/201423 private void Button_Click_1(object sender, RoutedEventArgs e) { // Launch a protocol Windows.System.Launcher.LaunchUriAsync(new Uri("jumpstart:NewSession")); }
  • 24. • Some protocols are reserved for the built-in apps • http:, MailTo:, Map: • Many more reserved by the OS • File:, Iehistory:, Javascript:, … many more… • If you try to reserve a protocol association using one of the reserved protocols, the reservation request will be ignored • See the documentation for a full list of the reserved protocols Reserved Protocol Associations 3/18/2014Microsoft confidential24
  • 25. URI scheme Description http:[URL] Launches the web browser and navigates to the specified URL. mailto:[email address] Launches the email app and creates a new message with the specified email address on the To line. Note that the email is not sent until the user taps send. ms-settings-accounts: Launches the Account Settings app. ms-settings-airplanemode: Launches the Airplane Mode Settings app. ms-settings-bluetooth: Launches the Bluetooth Settings app. ms-settings-cellular: Launches the Cellular Settings app. ms-settings-emailandaccounts: Launches the email and accounts settings app. ms-settings-location: Launches the Location Settings app. ms-settings-lock: Launches the Lock Screen settings app. ms-settings-wifi: Launches the Wi-Fi Settings app. Launching Built-in Apps Use LaunchUriAsync to launch many of the built-in apps 3/18/2014Microsoft confidential25
  • 26. Launching Built-in Apps (cont) 3/18/2014Microsoft confidential26 URI scheme Description zune:navigate?appid=[app ID] Launches the Windows Phone Store and shows the details page for the specified app. zune:reviewapp Launches the Store and shows the review page for the calling app. zune:reviewapp?appid=[app ID] Launches the Store and shows the review page for the specified app. zune:search?[search parameter]=[value] Launches the Store and searches for the specified content. zune:search?keyword=[search keyword] &contenttype=app Launches the Store and searches for apps by keyword. zune:search?publisher=[publisher name] Launches the Store and searches for items by publisher name.
  • 27. • App can register to handle particular file types • When the user opens a file from a website, email message or SMS message, your app is launched to process the file • One app can launch another by launching a file of a type for which the second app has registered a file association • App can register for an association with particular URI protocols • One app can launch another by launching a URI using a protocol for which the second app has registered a protocol association • If more than one app has registered the same file or protocol association, the user is asked to select which app should be launched Summary 3/18/2014
  • 28. The information herein is for informational purposes only an represents the current view of Microsoft Corporation as of the date of this presentation. Because Microsoft must respond to changing market conditions, it should not be interpreted to be a commitment on the part of Microsoft, and Microsoft cannot guarantee the accuracy of any information provided after the date of this presentation. © 2012 Microsoft Corporation. All rights reserved. Microsoft, Windows, Windows Vista and other product names are or may be registered trademarks and/or trademarks in the U.S. and/or other countries. MICROSOFT MAKES NO WARRANTIES, EXPRESS, IMPLIED OR STATUTORY, AS TO THE INFORMATION IN THIS PRESENTATION.

Notas del editor

  1. This session is about File and Protocol Associations.It is perhaps erroneously referred to as ‘App to App’ communication, which although being one of the interesting things you can do with it, is not the *only* thing.It’s about some interesting ways you can launch your app to handle specific files that are being sent to it, or because an app or the shell has ‘opened’ a particular custom URI that your app is registered to handle.
  2. You can use file and URI associations in Windows Phone 8 to automatically launch your app when another app launches a specific file type or URI scheme. When launched, a deep link URI is used to send the file (a reference to the file) or URI to your app. You can also use the association launching API to launch another app in the same way.File associations allow your app to automatically launch when the user wants to open a particular file. That file could come from a variety of sources including, but not limited to: an email attachmenta website via Internet Explorera Near Field Communications (NFC) taganother app from the StoreA URI association allows your app to automatically launch when another app launches a special URI. What makes that URI special is that it begins with a URI scheme name that your app has registered for. The URI scheme name is the portion of the URI that comes just before the colon (‘:’).
  3. How association works for the user When the user launches a file or URI from an app, what happens next depends on which apps are installed on the phone. If no apps on the phone can handle that particular file or protocol association, the user will be given the option to get one that does.When there is only one app on the phone registered for a particular file or protocol association, that app will be automatically launched when the user wants to open it. If a user has more than one app on their phone registered for a file or protocol association, each time the user opens the file, they will be as asked which app they want to use.Tip: Don’t register for a file or protocol association unless you can perform a useful action with it. If your app causes the app menu to be shown frequently, the user may choose to uninstall it altogether to avoid having to always make a choice.
  4. Like Windows 8, Windows Phone 8 uses Launcher..::..LaunchFileAsync(IStorageFile) to launch a file and Launcher..::..LaunchUriAsync(Uri) to launch a URI. However, the way Windows Phone XAML apps receive a file or URI is different. Also, Windows Phone does not have a “default” Store app. If there are multiple Store apps installed that can handle a particular file or URI association, the user chooses the receiving app from a menu.
  5. For demonstration notes please look in the “Demonstration” folder and open the corresponding Word document.
  6. To handle a particular file type, register for a file association in the app manifest file. Your app can specify any file association that it is able to handle. However, any file associations that are reserved by built-in apps will be ignored (we’ll look at what those are a little later).To provide an “integrated” look to custom file types appearing in built-in apps, you have the option of supplying logos (image files) to appear beside the files. For example, if a file (of your custom type) were attached to an email message, a small logo would appear beside the attachment after it was downloaded. The table on the slide lists the three image sizes that you can provide for each file association.
  7. You can specify a number of elements in a FileTypeAssociation:Extensions - Must follow the Tokens element.FileTypeAssociation -Describes a file association. You can register a maximum of 20 file associations. The Name attribute is required, but you choose your own friendly name. Specify the TaskID and NavUriFragment elements as shown.Logos - Lists all logos for a file association. This is optional when no logos are specified. You must provide all sizes (small, medium, large) if you provide any.SupportedFileTypes - Lists all file extensions that are associated with the file type.FileType - Lists the file extension that is associated with the file type, including the period (‘.’). You can associate a maximum of 20 file extensions with each file association.
  8. When your app is launched to handle a particular file type, a deep link URI is used to take the user to your app. Within the URI, the FileTypeAssociation string designates that the source of the URI is a file association and the fileToken parameter contains the file token. Upon launch, map the incoming deep link URI to an app page that can handle the file. Your app will launch at the standard launch page, but if you have multiple pages to handle multiple file types, create a custom URI mapper and in it call the GetSharedFileName method to check the file type before mapping the URI.
  9. Here’s an example of a custom URI Mapper.This first checks that the deep link Uri is from a File Type Association. It then extracts the FileID which has been supplied in the deeplink URI query string, which you can pass to the SharedStorageAccessManager.GetSharedFileName() method to get the filename of the fie you are being sent.
  10. Then based on the file extension, we route the request to a particular page.
  11. This is how you wire in your custom URI Mapper.When the app is launched, it assigns the URI mapper during initialization. Before launching any pages, the app calls the MapUri method of the URI mapper to determine which page to launch. The URI that the URI mapper returns is the page that the app launches.
  12. Don’t be mistaken into thinking that the SharedStorage area is some kind of shared folder to which you have complete read/write access.No, it’s just a temporary storage area used by the OS where it stores the file while it attempts to launch your app.[Click to play animation]The file comes in either by email, or from a webpage, or from another app and is copied into SharedStorage.Your app is then launched and passed a token to that file, and all it can do is to copy that file from SharedStorage into its local folder, whereupon it can open the file and process it.
  13. In your app, your UriMapper has mapped the File Association launch into a navigation to a particular page.On the target page, your OnNavigatedTo method executes as normal, and you can extract the data from the query string (you must be sure that your UriMapper passes the File Token in the query string it sends to the launched page).Then you can use the SharedStorageAccessManager.GetSharedFileName(fileToken) to get the name of the file, and the SharedStorageAccessManager.CopySharedFileAsync(…) method to copy the file from SharedStorage into the local folder.
  14. As mentioned earlier, your app also can launch a file, so another app can open it. To do this, use the LauncherLaunchFileAsync(IStorageFile) method from the Launcher object of the Windows.System namespace. For example, the code shown launches a fictitious Contoso bug query file from local storage.
  15. There are over 100 reserved file extensions, including all the usual suspects.See the docs for full details.
  16. For demonstration notes please look in the “Demonstration” folder and open the corresponding Word document.
  17. A URI association allows your app to automatically launch when another app launches a special URI. What makes that URI special is that it begins with a URI scheme name that your app has registered for. The URI scheme name is the portion of the URI that comes just before the colon (‘:’). The URI scheme includes the URI scheme name and all of the URI that follows the colon. For example, in the URI scheme shown, contoso is the URI scheme name.After the colon, the rest of the URI is open to however you want to use the URI association. When your app is launched, it has the opportunity to inspect the URI and behave differently based on what is in the URI. In this example, the receiving app has been designed to show all products within a particular category.
  18. To register your app for a protocol association, add a Protocol element inside the Extensions element.Extensions - Must follow the Tokens element.FileTypeAssociation -Describes a file association. You can register a maximum of 20 file associations. The Name attribute is required, but you choose your own friendly name. Specify the TaskID and NavUriFragment elements as shown.Logos - Lists all logos for a file association. This is optional when no logos are specified. You must provide all sizes (small, medium, large) if you provide any.SupportedFileTypes - Lists all file extensions that are associated with the file type.FileType - Lists the file extension that is associated with the file type, including the period (‘.’). You can associate a maximum of 20 file extensions with each file association.
  19. The process of handling a launch for a protocol association is exactly the same as with File associations. In this case, the deep link URI starts with /Protocol?encodedLaunchUri, so create a UriMapper that looks for that and maps the launch to the appropriate page in your application.
  20. One app can use this to launch another app. To do this, use the LauncherUriAsync(Uri) method from the Launcher object of the Windows.System namespace.
  21. As with file associations, certain URIs are reserved for system use. If you try to reserve one of tese, your registration request will be ignored.Again, see the docs for full details.
  22. As already mentioned in the Accessing Phone Resources module, the LaunchUriAsync method is also used to launch several built-in applications. This usage is shown here in this table, and as you can see is mainly used for launching settings dialogs, but may also be used to launch the browser or the built-in New email application.
  23. Certain of the built-in URIs map to the Windows Phone Store. This is useful for adding links onto the ‘About’ page of your app to encourage users to add feedback (positive hopefully!) or to lead them to other apps you have published.
  24. For demonstration notes please look in the “Demonstration” folder and open the corresponding Word document.