1
0
Форкнуть 0
surface-duo-sdk-xamarin-sam.../IntentToSecondScreen
Craig Dunn d5fce5d26e
[WindowManager] update to 1.0.0 stable release (#34)
* [WindowManager] update to rc01

test NuGets from CI https://github.com/xamarin/AndroidX/pull/449

* [all] update Jetpack Window Manager (rc01)

* [all] update Jetpack Window Manager (1.0.0 stable)

* tweaks

* add comments re 1.0.0.7 stable version update

* [windowmanager] config tweaks

* update README for Jetpack Window Manager support
2022-02-23 10:47:46 -08:00
..
Properties 5.0 updates (#11) 2021-02-04 11:09:17 -08:00
Resources 5.0 updates (#11) 2021-02-04 11:09:17 -08:00
Screenshots add readmes for all sample folders in the solution (#8) 2021-01-06 08:48:26 -08:00
IntentToSecondScreen.csproj [WindowManager] update to 1.0.0 stable release (#34) 2022-02-23 10:47:46 -08:00
MainActivity.cs Added new samples ported from android native 2020-02-21 22:37:40 -05:00
README.md add readmes for all sample folders in the solution (#8) 2021-01-06 08:48:26 -08:00
SecondActivity.cs Added new samples ported from android native 2020-02-21 22:37:40 -05:00

README.md

Intent to second screen sample for Surface Duo (using C# and Xamarin)

This sample demonstrates how to cause an activity to open on the second screen (as long as it's empty, otherwise the activity will launch over the current one).

In the main activity, choose an option to start: another activity from the current app or a URL in a browser window:

Intent to second screen menu

If the launcher is still visible on the other screen, the new activity will appear there:

Intent opened on second screen

The sample uses these functions to set the intent flags required to start on the second screen if available:

void StartIntentSecondActivity()
{
    var intent = new Intent(this, typeof(SecondActivity));
    // Intent.FLAG_ACTIVITY_LAUNCH_ADJACENT is required to launch a second activity
    // on a second display while still keeping the first activity on the first display
    // (not pausing/stopping it)
    intent.AddFlags(ActivityFlags.LaunchAdjacent | ActivityFlags.NewTask);
    StartActivity(intent);
}

void StartIntentBrowserApp(string url)
{
    var intent = new Intent(Intent.ActionView, Android.Net.Uri.Parse(url));
    intent.AddFlags(ActivityFlags.LaunchAdjacent | ActivityFlags.NewTask);
    StartActivity(intent);
}