Note
Access to this page requires authorization. You can try signing in or changing directories.
Access to this page requires authorization. You can try changing directories.
The Surface Duo SDK for Xamarin apps is available from NuGet. Add the correct NuGet for your project type using the instructions below.
Xamarin.Forms
Follow these steps to add the Surface Duo SDK to a Xamarin.Forms project:
Open the NuGet Package Manager dialog for your project.
Under the Browse tab, search for
Xamarin.Forms.DualScreen.Install the
Xamarin.Forms.DualScreenpackage into your project.Add the the following initialization method call to the Android project's
MainActivityclass, in theOnCreateevent:Xamarin.Forms.DualScreen.DualScreenService.Init(this);This method is required for the app to be able to detect changes in the app's state, such as being spanned across two screens.
Update the
Activityattribute on the Android project'sMainActivityclass, so that it includes all theseConfigurationChangesoptions:ConfigurationChanges = ConfigChanges.ScreenSize | ConfigChanges.Orientation | ConfigChanges.ScreenLayout | ConfigChanges.SmallestScreenSize | ConfigChanges.UiModeThese values are required so that configuration changes and span state can be more reliably reported.
The APIs from the Surface Duo SDK for Xamarin.Forms will be available in the Xamarin.Forms.DualScreen namespace. The Xamarin.Forms SDK consists of two parts:
Xamarin.Android
Follow these steps to add the Surface Duo SDK to a Xamarin.Android project:
- Open the NuGet Package Manager dialog for your project.
- Under the Browse tab, search for
Xamarin.DuoSdk. - Install the
Xamarin.DuoSdkpackage into your project.
You can review the Microsoft dual-screen SDK reference. The APIs from the Surface Duo SDK for Xamarin are available in the Microsoft.Device.Display namespace.
Samples
Visit the Xamarin samples to see examples of the SDK for both Xamarin.Forms and Xamarin.Android.