Merge branch 'master' of https://cpubwin.visualstudio.com/_git/project-rome into ios-appservices
This commit is contained in:
Коммит
407f6d6525
|
@ -26,14 +26,18 @@ RemoteSystemStatusTypeFilter statusFilter = new RemoteSystemStatusTypeFilter(Rem
|
|||
```
|
||||
For a look at all of the options available to each filter type, see the reference documentation of the filter objects being used.
|
||||
|
||||
Next, pass these filters into a **RemoteSystemDiscovery.Builder** instance, which will later be used to produce a **RemoteSystemDiscovery** object.
|
||||
Next, pass these filters into a **RemoteSystemDiscovery.Builder** instance, and use it to produce a **RemoteSystemDiscovery** object.
|
||||
|
||||
```java
|
||||
RemoteSystemDiscovery.Builder discoveryBuilder = new RemoteSystemDiscovery.Builder();
|
||||
// add the filters
|
||||
discoveryBuilder.filter(kindFilter);
|
||||
discoveryBuilder.filter(discoveryFilter);
|
||||
discoveryBuilder.filter(statusFilter);
|
||||
RemoteSystemDiscovery discovery = new RemoteSystemDiscovery.Builder()
|
||||
.filter(kindFilter) // add the filters
|
||||
.filter(discoveryFilter)
|
||||
.filter(statusFilter)
|
||||
.setListener(new IRemoteSystemDiscoveryListener() {
|
||||
//...
|
||||
}) // set the listener for discovery events
|
||||
.getResult(); // return a RemoteSystemDiscovery instance
|
||||
|
||||
|
||||
```
|
||||
|
||||
|
|
|
@ -62,11 +62,12 @@ Platform.initialize(getApplicationContext(),
|
|||
}
|
||||
|
||||
@Override
|
||||
// Connected Devices platform also needs the app's client id to initialize
|
||||
// Connected Devices platform also needs the app id to initialize
|
||||
public String getClientId() {
|
||||
// recommended: retrieve client id previously and store as a global constant.
|
||||
// The client id is provided when you register your app on the Microsoft developer portal
|
||||
return CLIENT_ID;
|
||||
// recommended: retrieve app id previously and store as a global constant.
|
||||
// The app id is provided when you register your app on the Microsoft developer portal
|
||||
// (https://apps.dev.microsoft.com/)
|
||||
return APP_ID;
|
||||
}
|
||||
},
|
||||
// Implement an IPlatformInitializationHandler - not required
|
||||
|
@ -170,30 +171,30 @@ The Android client SDK, like the Windows implementation, uses a watcher pattern
|
|||
Get an instance of **RemoteSystemDiscovery** using its corresponding Builder class. At this point you must also instantiate a custom **RemoteSystemsListener** to handle the discovery events. You may want to show and maintain a list view of all the available remote devices and their basic info.
|
||||
|
||||
```java
|
||||
RemoteSystemDiscovery.Builder discoveryBuilder;
|
||||
|
||||
discoveryBuilder = new RemoteSystemDiscovery.Builder().setListener(new IRemoteSystemDiscoveryListener() {
|
||||
@Override
|
||||
public void onRemoteSystemAdded(RemoteSystem remoteSystem) {
|
||||
// handle the added event. At minimum, you should acquire a
|
||||
// reference to the discovered device.
|
||||
}
|
||||
@Override
|
||||
public void onRemoteSystemUpdated(RemoteSystem remoteSystem) {
|
||||
// update the reference to the device
|
||||
}
|
||||
@Override
|
||||
public void onRemoteSystemRemoved(String remoteSystemId) {
|
||||
// remove the reference to the device
|
||||
}
|
||||
@Override
|
||||
public void onComplete(){
|
||||
// execute code when the initial discovery process has completed
|
||||
}
|
||||
});
|
||||
// use the builder pattern to get a RemoteSystemDiscovery instance.
|
||||
RemoteSystemDiscovery discovery = new RemoteSystemDiscovery.Builder()
|
||||
.setListener(new IRemoteSystemDiscoveryListener() { // set the listener for discovery events
|
||||
@Override
|
||||
public void onRemoteSystemAdded(RemoteSystem remoteSystem) {
|
||||
// handle the added event. At minimum, you should acquire a
|
||||
// reference to the discovered device.
|
||||
}
|
||||
@Override
|
||||
public void onRemoteSystemUpdated(RemoteSystem remoteSystem) {
|
||||
// update the reference to the device
|
||||
}
|
||||
@Override
|
||||
public void onRemoteSystemRemoved(String remoteSystemId) {
|
||||
// remove the reference to the device
|
||||
}
|
||||
@Override
|
||||
public void onComplete(){
|
||||
// execute code when the initial discovery process has completed
|
||||
}
|
||||
})
|
||||
.getResult(); // return a RemoteSystemDiscovery instance
|
||||
|
||||
// get the discovery instance
|
||||
RemoteSystemDiscovery discovery = discoveryBuilder.getResult();
|
||||
// begin watching for remote devices
|
||||
discovery.start();
|
||||
```
|
||||
|
|
|
@ -21,4 +21,4 @@ Called within the **Platform.initialize** method when the Remote Systems platfor
|
|||
`String getClientId()`
|
||||
|
||||
**Return value**
|
||||
The client ID that represents the current application
|
||||
The ID that represents the current application
|
||||
|
|
|
@ -27,11 +27,11 @@ Closes the Remote Systems platform.
|
|||
`public static void shutdown()`
|
||||
|
||||
### suspend
|
||||
Suspends the Remote Systems platform. Recommended to invoke in Activity.onPause(). Safe to call even if platform is not yet initialized.
|
||||
Suspends the Remote Systems platform. Recommended to invoke in ```Activity.onPause()```. Safe to call even if platform is not yet initialized.
|
||||
|
||||
`public static void suspend()`
|
||||
|
||||
### resume
|
||||
Resumes the Remote Systems platform from suspension. Recommended to invoke in Activity.onPause(). Safe to call even if platform is not yet initialized.
|
||||
Resumes the Remote Systems platform from suspension. Recommended to invoke in ```Activity.onResume()```. Safe to call even if platform is not yet initialized.
|
||||
|
||||
`public static void resume()`
|
||||
`public static void resume()`
|
||||
|
|
|
@ -32,8 +32,8 @@ import com.microsoft.connecteddevices.PlatformInitializationStatus;
|
|||
import java.util.Random;
|
||||
|
||||
public class MainActivity extends FragmentActivity implements ActivityCompat.OnRequestPermissionsResultCallback {
|
||||
// Use your own Client ID, assigned when your app was registered with MSA from https://apps.dev.microsoft.com/
|
||||
// private static String CLIENT_ID = "";
|
||||
// Use your own App ID, assigned when your app was registered with MSA from https://apps.dev.microsoft.com/
|
||||
// private static String APP_ID = "";
|
||||
|
||||
private int _permissionRequestCode = -1;
|
||||
private TextView _statusOutput;
|
||||
|
@ -194,10 +194,10 @@ public class MainActivity extends FragmentActivity implements ActivityCompat.OnR
|
|||
|
||||
@Override
|
||||
/**
|
||||
* ConnectedDevices Platform needs your app's registered client ID.
|
||||
* ConnectedDevices Platform needs your app's registered app ID.
|
||||
*/
|
||||
public String getClientId() {
|
||||
return CLIENT_ID;
|
||||
return APP_ID;
|
||||
}
|
||||
}, new IPlatformInitializationHandler() {
|
||||
@Override
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
# Project Rome for Microsoft Graph
|
||||
|
||||
Project Rome features can be implemented through REST API calls with [Microsoft Graph](http://graph.microsoft.com). This allows you to discover your windows devices, launch apps, and interact with app services from any device capable of making HTTP requests. The following REST APIs are meant for these scenarios. Follow the links for full reference documentation.
|
||||
Project Rome features can be implemented through REST API calls with [Microsoft Graph](https://developer.microsoft.com/graph/docs/api-reference/beta/resources/project_rome_overview). This allows you to discover your windows devices, launch apps, and interact with app services from any device capable of making HTTP requests. The following REST APIs are meant for these scenarios. Follow the links for full reference documentation.
|
||||
|
||||
* [List the user's devices](https://developer.microsoft.com/en-us/graph/docs/api-reference/beta/api/user_list_devices)
|
||||
|
||||
|
|
|
@ -25,9 +25,9 @@ Project Rome is currently implemented for the following scenarios. Follow the li
|
|||
[android-sample]: Android/sample
|
||||
[android-docs]: Android/reference%20documentation
|
||||
|
||||
[graph-sdk]: https://developer.microsoft.com/en-us/graph/code-samples-and-sdks
|
||||
[graph-sdk]: https://developer.microsoft.com/graph/docs/api-reference/beta/resources/project_rome_overview
|
||||
[graph-sdk-badge]: https://img.shields.io/badge/REST-Beta-orange.svg?style=flat-square
|
||||
[graph-sample]: https://developer.microsoft.com/en-us/graph/code-samples-and-sdks
|
||||
[graph-sample]: https://developer.microsoft.com/graph/docs/api-reference/beta/resources/project_rome_overview
|
||||
[graph-docs]: MSGraph/
|
||||
|
||||
| Platform Samples | SDK Package | API Docs
|
||||
|
|
|
@ -22,14 +22,14 @@ Xamarin plugin to allow access to the Project Rome Connected Device APIs on Andr
|
|||
|
||||
#### Pre-requisites
|
||||
1. Visual Studio 2015 or 2017 RC with Xamarin or Xamarin Studio
|
||||
2. Register your applciation and obtain an MSA client ID from
|
||||
2. Register your application and obtain an MSA app ID from
|
||||
[https://apps.dev.microsoft.com](https://apps.dev.microsoft.com)
|
||||
|
||||
#### Getting Started
|
||||
Initialize the Connected Devices Platform
|
||||
```csharp
|
||||
Platform.FetchAuthCode += Platform_FetchAuthCode;
|
||||
var result = await Platform.InitializeAsync(this.ApplicationContext, CLIENT_ID);
|
||||
var result = await Platform.InitializeAsync(this.ApplicationContext, APP_ID);
|
||||
```
|
||||
|
||||
The FetchAuthCode handler is used when the platform needs an authorization code from the user (i.e. form OAuth with Microsoft Account). See the sample for more details.
|
||||
|
|
|
@ -24,8 +24,8 @@ namespace ConnectedDevices.Xamarin.Droid.Sample
|
|||
[Activity(Label = "Connected Devices", MainLauncher = true, Icon = "@drawable/icon")]
|
||||
public class MainActivity : ListActivity
|
||||
{
|
||||
// Use your own client id
|
||||
// private const string CLIENT_ID = ""; //get a client ID from https://apps.dev.microsoft.com/
|
||||
// Use your own app id
|
||||
// private const string APP_ID = ""; //get an app ID from https://apps.dev.microsoft.com/
|
||||
|
||||
private WebView _webView;
|
||||
internal Dialog _authDialog;
|
||||
|
@ -46,9 +46,9 @@ namespace ConnectedDevices.Xamarin.Droid.Sample
|
|||
RefreshDevices();
|
||||
};
|
||||
|
||||
if(string.IsNullOrEmpty(CLIENT_ID))
|
||||
if(string.IsNullOrEmpty(APP_ID))
|
||||
{
|
||||
Toast.MakeText(this, "CLIENT_ID not set!", ToastLength.Long).Show();
|
||||
Toast.MakeText(this, "APP_ID not set!", ToastLength.Long).Show();
|
||||
}
|
||||
|
||||
InitializeAsync();
|
||||
|
@ -60,7 +60,7 @@ namespace ConnectedDevices.Xamarin.Droid.Sample
|
|||
internal async void InitializeAsync()
|
||||
{
|
||||
Platform.FetchAuthCode += Platform_FetchAuthCode;
|
||||
var result = await Platform.InitializeAsync(this.ApplicationContext, CLIENT_ID);
|
||||
var result = await Platform.InitializeAsync(this.ApplicationContext, APP_ID);
|
||||
|
||||
if (result == true)
|
||||
{
|
||||
|
|
|
@ -85,7 +85,7 @@ Back over to our Xamarin Android poject, we can add the [Microsoft.ConnectedDevi
|
|||
... and authenticate and initialize the Connected Devices platform:
|
||||
```csharp
|
||||
Platform.FetchAuthCode += Platform_FetchAuthCode;
|
||||
var result = await Platform.InitializeAsync(this.ApplicationContext, CLIENT_ID); //CLIENT_ID from https://apps.dev.microsoft.com
|
||||
var result = await Platform.InitializeAsync(this.ApplicationContext, APP_ID); //APP_ID from https://apps.dev.microsoft.com
|
||||
```
|
||||
The FetchAuthCode handler is used when the platform needs an authorization code from the user (i.e. form OAuth with Microsoft Account). See the sample for more details.
|
||||
```csharp
|
||||
|
|
|
@ -14,8 +14,8 @@ namespace RomeCastRemote
|
|||
[Activity(Label = "RomeCast Remote Control", MainLauncher = true, Icon = "@mipmap/icon")]
|
||||
public class MainActivity : Activity
|
||||
{
|
||||
// Use your own client id
|
||||
private const string CLIENT_ID = ""; //get a client ID from https://apps.dev.microsoft.com/
|
||||
// Use your own app id
|
||||
private const string APP_ID = ""; //get an app ID from https://apps.dev.microsoft.com/
|
||||
|
||||
private WebView _webView;
|
||||
internal Dialog _authDialog;
|
||||
|
@ -33,7 +33,7 @@ namespace RomeCastRemote
|
|||
SetContentView(Resource.Layout.Main);
|
||||
|
||||
Platform.FetchAuthCode += Platform_FetchAuthCode;
|
||||
var result = await Platform.InitializeAsync(this.ApplicationContext, CLIENT_ID);
|
||||
var result = await Platform.InitializeAsync(this.ApplicationContext, APP_ID);
|
||||
|
||||
DiscoverDevices();
|
||||
|
||||
|
|
|
@ -18,7 +18,7 @@ The simplest way to add the Remote Systems platform to your iOS app is by using
|
|||
platform :ios, '10.0'
|
||||
|
||||
target 'ProjectName' do
|
||||
pod 'ProjectRomeSdk', '~>0.0.3'
|
||||
pod 'ProjectRomeSdk', '~>0.6.2'
|
||||
end
|
||||
```
|
||||
|
||||
|
|
Двоичный файл не отображается.
|
@ -102,7 +102,7 @@
|
|||
|
||||
- (NSString*)appId
|
||||
{
|
||||
// Change to your own app's MSA Client ID
|
||||
// Change to your own app's MSA app ID
|
||||
return @"8a284efa-414b-445e-8710-0fabde940942";
|
||||
}
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче