Skip to content

Commit 83697d1

Browse files
Merge pull request #44653 from jennyf19/patch-2
Update Android doc to not use manifest
2 parents 77ebdef + 75b8d5c commit 83697d1

File tree

1 file changed

+19
-2
lines changed

1 file changed

+19
-2
lines changed

articles/active-directory/develop/msal-net-xamarin-android-considerations.md

Lines changed: 19 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ title: Xamarin Android considerations (MSAL.NET) | Azure
33
titleSuffix: Microsoft identity platform
44
description: Learn about specific considerations when using Xamarin Android with the Microsoft Authentication Library for .NET (MSAL.NET).
55
services: active-directory
6-
author: TylerMSFT
6+
author: jmprieur
77
manager: CelesteDG
88

99
ms.service: active-directory
@@ -80,6 +80,23 @@ The `AndroidManifest.xml` should contain the following values:
8080
</activity>
8181
```
8282

83+
Or, you can [create the activity in code](https://docs.microsoft.com/xamarin/android/platform/android-manifest#the-basics) and not manually edit `AndroidManifest.xml`. For that, you must create a class that has the `Activity` and `IntentFilter` attribute. A class that represents the same values of the above xml would be:
84+
85+
```csharp
86+
[Activity]
87+
[IntentFilter(new[] { Intent.ActionView },
88+
Categories = new[] { Intent.CategoryBrowsable, Intent.CategoryDefault },
89+
DataHost = "auth",
90+
DataScheme = "msal{client_id}")]
91+
public class MsalActivity : BrowserTabActivity
92+
{
93+
}
94+
```
95+
96+
### XamarinForms 4.3.X manifest
97+
98+
The code generated by XamarinForms 4.3.x sets the `package` attribute to `com.companyname.{appName}` in the `AndroidManifest.xml`. You might want to change the value to be same as the `MainActivity.cs` namespace, if you use the `DataScheme` as `msal{client_id}`.
99+
83100
## Use the embedded web view (optional)
84101

85102
By default MSAL.NET uses the system web browser, which enables you to get SSO with Web applications and other apps. In some rare cases, you might want to specify that you want to use the embedded web view. For more information, see [MSAL.NET uses a Web browser](msal-net-web-browsers.md) and [Android system browser](msal-net-system-browser-android-considerations.md).
@@ -124,4 +141,4 @@ More details and samples are provided in the [Android Specific Considerations](h
124141
125142
| Sample | Platform | Description |
126143
| ------ | -------- | ----------- |
127-
|[https://github.com/Azure-Samples/active-directory-xamarin-native-v2](https://github.com/azure-samples/active-directory-xamarin-native-v2) | Xamarin iOS, Android, UWP | A simple Xamarin Forms app showcasing how to use MSAL to authenticate MSA and Azure AD via the AADD v2.0 endpoint, and access the Microsoft Graph with the resulting token. <br>![Topology](media/msal-net-xamarin-android-considerations/topology.png) |
144+
|[https://github.com/Azure-Samples/active-directory-xamarin-native-v2](https://github.com/azure-samples/active-directory-xamarin-native-v2) | Xamarin iOS, Android, UWP | A simple Xamarin Forms app showcasing how to use MSAL to authenticate MSA and Azure AD via the AADD v2.0 endpoint, and access the Microsoft Graph with the resulting token. <br>![Topology](media/msal-net-xamarin-android-considerations/topology.png) |

0 commit comments

Comments
 (0)