Project Rome
repository·master·Indexed 19 days ago
https://github.com/microsoft/project-romeA cross-device experiences platform from Microsoft that enables applications to provide seamless, user-centric experiences across different devices. It decouples applications from specific hardware and provides SDKs for Windows, Android, and iOS, as well as integration via Microsoft Graph REST API endpoints for features like the Activity Feed API and Device Relay API.
What's inside Project Rome
- Project Rome is Microsoft's cross-device experiences platform. It is designed to decouple applications from specific hardware, allowing developers to build user-centric experiences that persist and function across multiple devices.
Integrate UserNotifications into iOS apps
masterMicrosoft Graph notifications are built on top of theUserNotificationsfeature provided by Project Rome. To integrate this feature into your own application, you should consult the officialUserNotifications API referencefor technical documentation and how-to guides.What is a cross-device app in Project Rome?
masterA cross-device app is a configuration that associates multiple platform-specific applications (e.g., Windows, iOS, Android, Web) into a single logical group. This configuration is required to enable seamless user experiences across different devices using Project Rome APIs.
By configuring a cross-device app, you can enable:
- Activity Feed API (Microsoft Graph): Allows a group of apps to read and write shared user activities, enabling features like "pick up where you left off."
- Project Rome SDK (Windows, Android, iOS): Enables reading and writing user activities published by any app within the configured group.
- Device Relay API (Android, iOS): Allows targeting specific apps on mobile devices using push notification credentials, enabling real-time workflow transitions (e.g., moving a video from a phone to an Xbox).
How Graph Notifications work with UNS ID
masterIn the Graph Notifications workflow, an App Service (e.g., Outlook) needs a way to identify a specific user to deliver a notification. This is achieved using the User Notification Subscription ID (UNS ID).
The Workflow:
- The Client App (Windows, iOS, Android, or Web) signs the user in.
- The Client App receives a UNS ID as part of the response after subscribing to notifications.
- The Client App sends this UNS ID to the App Service.
- The App Service uses the UNS ID to call Microsoft Graph and post a notification specifically to that user on their device.
Terminology for Graph Notifications
masterWhen working with this sample and the underlying notification architecture, use the following terms:
- Sample App/Client App: The application (Windows, iOS, Android, or Web) where the user signs in.
- Sample API/App Service: The service that intends to post a notification.
- Azure AD: The Identity Service.
- AFS/WNS: Internal Microsoft services supporting the graph notifications scenario.
Understand the On-Behalf-Of (OBO) flow for Graph Notifications
masterIn the Graph Notifications scenario, an App Service (A.S.) needs to identify a user to post notifications. While the client app can send a User Access Token (AT) directly, these tokens expire every hour.
To provide a more permanent solution, the On-Behalf-Of (OBO) flow is used:
- The client app sends the User's AT to the App Service.
- The App Service exchanges this User AT for an OBO token (Access Token and Refresh Token) from the Identity Service (Azure AD) using its own client credentials.
- The App Service uses the OBO token to hit the Graph endpoint.
Note: This is a transitional solution. Future versions of the SDK/API will replace user authentication with a User Identifier (UNSId), which only needs to be sent to the App Service once during subscription.
Configure app clients with the cross-device host value
masterOnce your domain is defined in the JSON file, your individual app clients must be configured to recognize that domain as their host.
MSGraph Apps
If using the Activity Feed API on MSGraph, provide your domain in the
activitySourceHostproperty.Universal Windows (UWP) Apps
Configure the host value in your app manifest under the
uap5:userActivityelement before publishing data.iOS & Android Apps
Details coming soon.
Setup the Graph Notifications Sample App Service
masterTo run the sample application which demonstrates using the On-Behalf-Of (OBO) flow for Graph notifications, follow these steps:
- Clone the repository to your local machine.
- Configure credentials in the following files:
siteConfig.js: UpdateappServiceClientIdwith your App Service ID from the Azure Portal.Web.config: UpdateappServiceClientSecretwith your App Service Secret from the Azure Portal.- Update
TargetHostNamewith the Domain name verified and associated with the App Service ID in the Dev Portal.
- Deploy locally using IIS Express within Visual Studio.
# No specific command provided, follow manual steps aboveAccess Project Rome developer documentation and samples
masterTo integrate Project Rome features into your application, use the following resources:
- Samples: This repository contains various samples of Project Rome implementations.
- Developer Docs: For detailed how-to guides and API reference documentation, visit the Project Rome developer docs.
- Microsoft Graph Integration: Project Rome capabilities are exposed via Microsoft Graph REST API endpoints. For conceptual overviews of cross-device experiences via Graph, refer to the Cross-Device Experience docs.
Demo Flow: Obtaining User AT and Exchanging for OBO Token
masterThe sample demonstrates a two-stage authentication flow:
1. Getting User's AT with correct Scopes
This logic typically resides in the client app:
- User signs in via 'Sign In with Microsoft'.
- User consents to Graph authorization scopes (defined in
siteConfig.jsundersite.graphNotificationScopes). - If the 'Access resources via On-Behalf-of' switch is enabled in the UI, the user also consents to App Service scopes (
site.appServiceScopesinsiteConfig.js), resulting in an access token with cumulative scopes.
2. Exchanging User's AT for OBO AT/RT
This logic resides in the App Service (
OboController.cs):- The client calls the submission endpoint (e.g.,
site.createNotificationsViaOboinsite.js). - The App Service calls
GetOboTokenAsync(viaPostAsync) to exchange the User's AT for an OBO token from Azure AD. - The App Service then uses the OBO token to send the request payload to the Graph endpoint.
Get started with Project Rome for Android
masterProject Rome for Android provides sample applications that demonstrate its features. To use these features, you must have:
- An Android app development IDE (such as Android Studio).
- An Android device or emulator running Android 4.4.2 or later.
Set up the Graph Notifications Sample App Service
masterTo run the sample App Service that demonstrates sending notifications using a User Notification Subscription ID (UNS ID), follow these steps:
- Clone the repository to your local environment.
- Configure credentials and identifiers in the configuration files (see Configuration Reference).
- Deploy locally using IIS Express within Visual Studio.