Download presentation
Presentation is loading. Please wait.
1
Mobile Development Name Title Company
2
Agenda Overview Phone Development Push Notifications
Location-Based Apps
3
Overview
4
Mobile Apps and SharePoint
List Apps OOB Lists Custom Lists External Lists General Apps Silverlight CSOM Phone apps can be based on SharePoint lists or simply use the Silverlight CSOM
5
Types of Mobile Apps Simple SharePoint List Apps
Use a SharePoint list as the data source Push Notification Apps Receive List Item events Receive Workflow state-change events Location-Aware Apps Utilizes the new Location field type Simple SharePoint List App This just uses a list as a data source and displays it on the phone Push Notification App SharePoint 2013 enables Windows Phone 7 applications to receive notifications about certain events in SharePoint Server, such as the addition of a new item to a SharePoint list or a change in stage in a workflow. Push notifications are relayed to Windows Phone 7 devices by the Microsoft Push Notification Service (MPNS), and these notifications can be received by the phone user even if the application is not running. This enables you to build Windows Phone applications that can receive notifications when some content or something of the user’s interest changes in SharePoint. For example, you can build a case management application where a call center executive creates a new customer service request in SharePoint and assigns it to a technician. The technician sees a notification of a new case assignment on the Case Management application on his or her phone and takes the necessary action. Location-Aware App Using the new Location field type in SharePoint 2013 Technical Preview lists, you can easily create location-aware applications. An example could be a "My Travel Organizer"-type of application that lets users view their travel plans that are stored in SharePoint by using their mobile phone, and also see who from their company is traveling to the same location on the same date. Another example could be expanding the previous case management scenario: The technician can find the location of his next customer on the Bing map and then use that information to get the driving directions from the current location on the phone
6
Overview - Roles SharePoint Users Phone Users Phone developers
WP Phone developers Visual Studio These are the roles involved, which are discussed in the next few slides SharePoint & Visual Studio SharePoint Developers
7
Roles SharePoint Developer Phone Developer Browser, SPD, or VS
Creates List Optionally Utilize Location Field Phone Developer VS, Blend List Wizard, Templates CSOM SharePoint & Visual Studio SharePoint Developers Phone developers Visual Studio SharePoint Developer The SP developer does what he always does. He creates lists (standard or external) that can be used as data sources for phone apps. He can include the Location field type in a list to support location-aware apps. Phone Developer Uses Visual Studio and the Phone project templates. The templates include a wizard that allows you wo easily create a phone app based on an existing list.
8
Security Supported Authentication Cross-Firewall Connectivity
Forms-Based Office 365 Basic Cross-Firewall Connectivity User Access Gateway Alternate Access Mapping To work against a SharePoint instance with the Windows Phone Developer Tools, you must have a server with either basic or forms-based authentication enabled when you are using an on-premises instance. By default, SharePoint Online has browser-based authentication enabled. During the connection and URL validation steps, the server prompts you for your credentials, which are cached.
9
Phone Development
10
Phone Development Environment
Supported Environment Windows 7 Visual Studio 2010 Installation Process Windows Phone 7.1 SDK Visual Studio 2010 templates (SPDXMobile.msi) Requires on-prem SharePoint 2013 environment Phone development is not now and will not be supported on server operating systems. Only Visual Studio 2010 is supported In order to create phone apps, you need an on-premise SharePoint 2013 environment. You also need a Windows 7 environment with Visual Studio 2010 Windows Phone 7.1 SDK Mobile App Templates (SDPXMobile.msi)
11
SharePoint Developer Role
Browser Development Custom Lists SharePoint Designer Development External Lists Visual Studio Development Apps Custom List Definitions External Content Types Again the point here is that the SharePoint developer just makes lists in the normal way
12
Phone Developer Experience
New Project Dialog Windows Phone Empty SharePoint Application Windows Phone SharePoint List Application The New project dialog contains two new projects for Phone Windows Phone Empty SharePoint Application When you create a new Visual Studio project using this template, you get an empty project with references to the necessary Windows Phone assemblies and the two SharePoint Phone-related client assemblies. The template allows for many possibilities, and it is up to the developer to write the necessary code for the desired SharePoint phone application Windows Phone SharePoint List Application This template lets you create one of the most common mobile applications you can create in SharePoint 2013 Technical Preview—that is, surface data from a SharePoint list in a Windows Phone application. When you create a new application using this template, you are prompted to enter a SharePoint on-premises or SharePoint Online URL and select a SharePoint list (both regular lists and external lists are supported). Visual Studio then auto-generates all the necessary files for the list mobile application. Without writing a single line of code, you can run the application (F5) and see the list data on the Windows Phone Emulator.
13
Phone Developer Experience
Windows Phone SharePoint List Application Launches a Wizard
14
Phone Developer Experience
Windows Phone SharePoint List Application Launches a Wizard Select List
15
Phone Developer Experience
Windows Phone SharePoint List Application Launches a Wizard Select List Select View
16
Phone Developer Experience
Windows Phone SharePoint List Application Launches a Wizard Select List Select View Select Operations
17
Phone Developer Experience
Windows Phone SharePoint List Application Launches a Wizard Select List Select View Select Operations Select Fields
18
Phone Developer Experience
Windows Phone SharePoint List Application Launches a Wizard Select List Select View Select Operations Select Fields Order the Fields
19
Phone Developer Experience
Windows Phone SharePoint List Application Launches a Wizard Select List Select View Select Operations Select Fields Order the Fields Project is Created
20
Model-View-ViewModel Pattern
Client Server View ViewModel Model The Silverlight applications created for the phone use the MVVM pattern. The Model-View-ViewModel (MVVM) pattern provides a flexible way to build Silverlight applications that promotes code re-use, simplifies maintenance and supports testing. The pattern consists of three different components including the Model (entities and code on the server), the View (the Silverlight screens) and the ViewModel (the glue between the Model and the View). The goal of the MVVM pattern is to separate the display of the data from the logic which is in turn separated from the data. The Views are the Silverlight screens created in XAML. Note that XAML doesn’t support any business logic. It simply displays the data. The Model is the SharePoint list The ViewModel contains all of the state management and logic for the application. The advantage of this separation is that it supports automated unit testing and ease of maintenance. Silverlight is uniquely-suited for MVVM pattern because it supports binding the XAML elements to objects delivered from the ViewModel layer.
21
Project Files Key File Description App.xaml
Handles application lifetime DisplayForm.xaml Defines the UI for displaying a list item on the phone EditForm.xaml Defines the UI for editing a list item on the phone NewForm.xaml Defines the UI for creating a new list item on the phone List.xaml Defines the UI for the All Items view on the phone ListViewModel Data source for the All Items view DisplayFormViewModel Data source for the display item view EditFormViewModel Data source for the edit item view NewFormViewModel Data source for the new item view DataCache Supports data caching and off-line access This table lists the various project files that are associated with phone development. The MVVM model makes it easy to modify the project after it is generated.
22
Silverlight Client Object Model on the Phone
ClientContext context = new ClientContext(ListUrl); Authenticator at = new Authenticator(); at.UserName = "pkmacct"; at.Password = "test!"; at.AuthenticationMode = ClientAuthenticationMode.FormsAuthentication; at.CredentialCachingEnabled = true; at.CookieCachingEnabled = true; context.Credentials = at; ListItemCollection items = context.Web.Lists.GetByTitle(ListName).GetItems(CamlQuery.CreateAllItemsQuery()); context.Load(items); context.ExecuteQueryAsync(succeed, failure);
23
OData Model on the Phone
ODataAuthenticator oat = new ODataAuthenticator(); oat.UserName = "pkmacct"; oat.Password = "test!"; oat.AuthenticationMode = ClientAuthenticationMode.FormsAuthentication; oat.CredentialCachingEnabled = true; oat.CookieCachingEnabled = true; oat.AuthenticationCompleted += new EventHandler<SendingRequestEventArgs>(OnAuthenticationCompleted); // The Authenticate method will raise the AuthenticationCompleted event. oat.Authenticate("My_service_URL");
24
Phone Development demo
25
Push Notifications
26
Push Notifications - Architecture
SharePoint 3. Phone registers with registration API, which writes information to subscription list in App. Server App The subscription list in the app is provisioned as part of feature Subscription Store (list in the app) Registration API 1. Get URI Notification API app 4. When an app event is fired, the app looks up the subscription list in app & then calls the notification API for all phones that need to be notified Push notifications allow for real-time notification of events. SharePoint apps are created that utilize the Microsoft Push Notification Service (MPNS), which is a cloud-based service This service send notifications to phone apps that are registered to receive them in the Host SPWeb When the phone app is installed, the end user is prompted to provide the URL of a Hosting SPWeb The phone app uses this information to contact the Host and get a channel URI from MPNS The phone app registers itself with the Subscriber Store of the Host SPWeb PNS 2. Return URI 5. PNS notifies the phones
27
Notification Types Toast Notifications Tile Notifications
Displayed at the top of the screen for 10 seconds Tapping the notification launches the App Tile Notifications Updates the a Tile on the Start area Raw Notifications Received when the target app is running
28
SharePoint Server Configuration
Push Notification Feature Allows a phone to register with the SPWeb Custom Code Developer must write code to send notifications SPWeb.PushNotificationSubscribers contains registrations Activating the "Push Notifications" feature allows phones to register with the SPWeb. A developer can take advantage of, for example, sending notifications to subscribed phones through MPNS based on identified events on the server (such as an item being added to a list), but doing so requires wiring up the relevant event and writing code on the server and writing "receiving" and subscription code for the phone.
29
Push Notifications - Registering for Notifications
clientContext.Web.RegisterPushNotificationSubscriber( SPPhoneNotificationSubscriberType.WP7, d231398c-f26b-4e5c-af57-ec7c5f694eb6, httpChannel.ChannelUri.AbsoluteUri); clientContext.ExecuteQueryAsync(onRegisterQuerySucceeded, onRegisterQueryFailed); Windows Phone Apps use the Silverlight Client Object Model to talk to SharePoint 2013 The RegisterPhoneNotificationSubscriber method registers the phone to receive events. SPPhoneNotificationSubscriberType.WP7 identifies the device as a Window Phone 7 d231398c-f26b-4e5c-af57-ec7c5f694eb6 is the ID of the specific instance of the Phone App httpChannel.ChannelUri.AbsoluteUri is the channel URI that will receive notifications
30
Push Notifications - Sending a Toast Notifications
<?xml version="1.0" encoding="utf-8"?> <wp:Notification xmlns:wp="WPNotification"> <wp:Toast> <wp:Text1>Title</wp:Text1> <wp:Text2>Message</wp:Text2> <wp:Param>Parameter</wp:Param> </wp:Toast> </wp:Notification> The notification is sent to the registered URI channel using an HttpWebRequest The above XML shows a sample of a Toast notification
31
Push Notifications demo
32
Location-Based Apps
33
Location Fields: SharePoint Lists
New Type of Field Contains Lat/Long Location Picker Map Type Ideal for Mobile Apps
34
Location Fields Adding a Location Field
public override void FeatureActivated(SPFeatureReceiverProperties properties) { SPWeb site = properties.Feature.Parent as SPWeb; SPList list = site.Lists.TryGetList("Service Calls"); if (list != null) list.Fields.AddFieldAsXml( "<Field Type='Geolocation' DisplayName='Location'/>", true, SPAddFieldOptions.Default); list.Update(); } Currently, location fields have to be added to a list using code.
35
Adding a Bing Maps key PowerShell
Set-SPBingMapsKey –BingKey <key> Client-Side OM ClientContext ctx = new ClientContext(" Web web = ctx.Web; web.AllProperties["BING_MAPS_KEY"] = <key>; web.Update(); ctx.ExecuteQuery(); Server-Side OM using (SPSite siteCollection = new SPSite(" { SPWeb site = siteCollection.RootWeb; site.AllProperties["BING_MAPS_KEY"] = <key>; site.Update(); } Currently, location fields have to be added to a list using code.
36
Location-Based Apps demo
37
Summary Overview Phone Development Push Notifications
Location-Based Apps
38
Q&A
39
© 2012 Microsoft Corporation. All rights reserved
© 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. The information herein is for informational purposes only and 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. MICROSOFT MAKES NO WARRANTIES, EXPRESS, IMPLIED OR STATUTORY, AS TO THE INFORMATION IN THIS PRESENTATION.
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.