1
0
Форкнуть 0
surface-duo-sdk-xamarin-sam.../IntentToSecondScreen
Craig Dunn 55b1d13212
add readmes for all sample folders in the solution (#8)
* Add readmes+screenshots

DragAndDrop and IntentToSecondScreen

* Add Xamarin.Forms readme+screenshots

* add READMEs for UX samples

* add screenshots and Xamarin.Android link

* minor updates to text
2021-01-06 08:48:26 -08:00
..
Properties Added new samples ported from android native 2020-02-21 22:37:40 -05:00
Resources Added new samples ported from android native 2020-02-21 22:37:40 -05:00
Screenshots add readmes for all sample folders in the solution (#8) 2021-01-06 08:48:26 -08:00
IntentToSecondScreen.csproj Update to latest forms and duo sdk 2020-03-04 11:54:39 -07: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);
}