# Mobile App: MAUI auto instrument

**URL:** <https://community.dynatrace.com/t/mobile-app-maui-auto-instrument/48856>\
**Category:** Real User Monitoring\
**Tags:** android, mobile-monitoring, ios\
**Created:** [November 12, 2024, 3:53pm UTC](https://community.dynatrace.com/t/mobile-app-maui-auto-instrument/48856 "2024-11-12T15:53:34Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Yann\_Buccellato](https://avatars.discourse-cdn.com/v4/letter/y/97f17d/32.png) [@Yann\_Buccellato](https://community.dynatrace.com/u/Yann_Buccellato)\
**Post date:** [November 12, 2024, 3:53pm UTC](https://community.dynatrace.com/t/mobile-app-maui-auto-instrument/48856/1 "2024-11-12T15:53:34Z")

</div>

Afternoon community,

we currently host a mobile Maui app for which we’d like to implement auto instrumentation.  
I think part of the auto-instrumentation is Step number 5 mentioned in the doc ([_Enabling automatic web request instrumentation )_](https://docs.dynatrace.com/docs/shortlink/maui#http-client)

The dev implementing this is using [httpclient factory](https://learn.microsoft.com/en-us/dotnet/core/extensions/httpclient-factory) which brings complexity in implementing the suggestion in Step 5.  
Has anyone experienced such complexity and how did you solve this?

Regards

---

<div class="post-metadata">

**Author:** ![matthias\_hochri](https://dub1.discourse-cdn.com/dynatrace/user_avatar/community.dynatrace.com/matthias_hochri/32/15052_2.png) [@matthias\_hochri](https://community.dynatrace.com/u/matthias_hochri)\
**Post date:** [November 14, 2024, 8:24am UTC](https://community.dynatrace.com/t/mobile-app-maui-auto-instrument/48856/2 "2024-11-14T08:24:47Z")

</div>

I don’t have direct experience with the HttpClientFactory, but documentation shows how to create the HttpMessageHandler.

and in your documentation example about the usage of HttpClientFactory I can see the following:

```markup
builder.Services.AddHttpClient();

```

So I would assume the following usage:

```markup
builder.Services.AddHttpClient()
.ConfigureHttpMessageHandler(() => { 
   return Agent.Instance.GetHttpMessageHandler();
});

```

or

```markup
builder.Services.AddHttpClient()
.ConfigureHttpMessageHandlerBuilder((builder) => { 
   builder.PrimaryHandler = Agent.Instance.GetHttpMessageHandler();
   builder.Build();
});​

```

See&nbsp;[Use the IHttpClientFactory - .NET | Microsoft Learn](https://learn.microsoft.com/en-us/dotnet/core/extensions/httpclient-factory#configure-the-httpmessagehandler)
