Dynatrace.OneAgent.Xamarin
7.2.8
Prefix Reserved
See the version list below for details.
dotnet add package Dynatrace.OneAgent.Xamarin --version 7.2.8
NuGet\Install-Package Dynatrace.OneAgent.Xamarin -Version 7.2.8
<PackageReference Include="Dynatrace.OneAgent.Xamarin" Version="7.2.8" />
paket add Dynatrace.OneAgent.Xamarin --version 7.2.8
#r "nuget: Dynatrace.OneAgent.Xamarin, 7.2.8"
// Install Dynatrace.OneAgent.Xamarin as a Cake Addin #addin nuget:?package=Dynatrace.OneAgent.Xamarin&version=7.2.8 // Install Dynatrace.OneAgent.Xamarin as a Cake Tool #tool nuget:?package=Dynatrace.OneAgent.Xamarin&version=7.2.8
Dynatrace OneAgent for Xamarin
Use this NuGet package to instrument your Xamarin Forms and Native apps with the Dynatrace OneAgent for mobile. Adding the package to your Xamarin projects will allow you to use auto instrumentation for Android and iOS. Additionally the package contains the required stub libraries to add manual instrumentation directly in your C# code.
Requirements of the NuGet package
- Android: API 15 and above
- iOS: iOS 6 and above
- Forms: .NET Standard 1.1 and above
Configuration for Android
Adding Properties File
The Android Auto-Instrumentation needs some properties in order to work correctly. Those properties can be viewed when you look into the documentation links that are provided at the bottom of this documentation, here.
The properties file shoud be in the assets folder of your Android application and should be called 'Dynatrace.properties'.
Adding Target (Only for Forms based application)
his only needs to be done for Forms applications. The target will invoke the Android auto-instrumentation every time you bundle/build your APK. Open your .csproj file of your Android application with a file editor of your choice and include the following target within the <Project> tag.
<Target Name="DynatraceInstrumentation" AfterTargets="_BuildApkEmbed" Condition="Exists('@(ApkFiles)')">
<PropertyGroup Condition=" '$(OS)' != 'Windows_NT' ">
<PathSeparator>/</PathSeparator>
<Instrumentor>instrument.sh</Instrumentor>
</PropertyGroup>
<PropertyGroup Condition=" '$(OS)' == 'Windows_NT' ">
<PathSeparator>\</PathSeparator>
<Instrumentor>instrument.cmd</Instrumentor>
</PropertyGroup>
<Error Condition="!Exists('$(ProjectDir)Assets$(PathSeparator)Dynatrace.properties')" Text="Properties File is not available!" />
<Error Condition="!Exists('%(ApkFiles.FullPath)')" Text="APK File(s) is (are) not available!" />
<ItemGroup>
<FilteredReferencesNuGet Include="@(_ReferencesFromNuGetPackages)" Condition="$([System.String]::new('%(_ReferencesFromNuGetPackages.FullPath)').Contains('Dynatrace.OneAgent.Android.dll'))" />
<FilteredReferences Include="@(Reference)" Condition="$([System.String]::new('%(Reference.HintPath)').Contains('Dynatrace.OneAgent'))" />
</ItemGroup>
<PropertyGroup>
<AgentDir Condition="'@(FilteredReferences)' != ''">@(FilteredReferences->'%(HintPath)')</AgentDir>
<AgentDir Condition="'@(FilteredReferencesNuGet)' != ''">@(FilteredReferencesNuGet->'%(FullPath)')</AgentDir>
<AgentDir Condition="'$(AgentDir.IndexOf(";"))' != -1">$(AgentDir.Substring(0, $(AgentDir.IndexOf(";"))))</AgentDir>
</PropertyGroup>
<Error Condition="!Exists('$(AgentDir.Substring(0, $(AgentDir.LastIndexOf("$(PathSeparator)lib"))))$(PathSeparator)tools$(PathSeparator)$(Instrumentor)')" Text="Agent component directory not found!" />
<Exec Command="
 "$(AgentDir.Substring(0, $(AgentDir.LastIndexOf("$(PathSeparator)lib"))))$(PathSeparator)tools$(PathSeparator)$(Instrumentor)" apk="%(ApkFiles.FullPath)" prop="$(ProjectDir)Assets$(PathSeparator)Dynatrace.properties"
" />
<Copy SourceFiles="@(ApkFiles)" DestinationFolder="$(IntermediateOutputPath)android$(PathSeparator)bin$(PathSeparator)orginal$(PathSeparator)" />
<Copy SourceFiles="$(IntermediateOutputPath)android$(PathSeparator)bin$(PathSeparator)%(ApkFiles.Filename)$(PathSeparator)dist$(PathSeparator)%(ApkFiles.Filename).apk" DestinationFolder="$(IntermediateOutputPath)android$(PathSeparator)bin$(PathSeparator)" />
<RemoveDir Directories="$(IntermediateOutputPath)android$(PathSeparator)bin$(PathSeparator)%(ApkFiles.Filename)" />
</Target>
Configuration for iOS
Adding Properties to .plist file
The iOS Auto-Instrumentation needs some properties in order to work correctly. Those properties can be viewed when you look into the documentation links that are provided at the bottom of this documentation, here.
Adding Manual call to the Dynatrace library
The Dynatrace framework would be removed during the build if no call happens to it. In this case it is necessary to add at least one call. Therefore you can use at the beginning of your application
Dynatrace.Start();
Manual Instrumentation in Xamarin Native
This can be done via DynatraceIOS or DynatraceAndroid. Please refer to the official documentation of the Mobile Agent which contains the description for the API. Be aware that the API might be slightly different because the libraries had to be converted.
Manual Instrumentation in Xamarin Forms
To be able to use the Mobile Agent, even though you are in a Forms application, we added interfaces which can be registered via dependency service. To use those, you have to register them in the Startup of your native application part. Place this code right after Forms.Init() :
Xamarin.Forms.DependencyService.Register<Dynatrace.Dynatrace>();
Xamarin.Forms.DependencyService.Register<Dynatrace.Action>();
Be aware that not all functions are available that are in the available through the native packages DynatraceIOS.* or DynatraceAndroid.* . The following piece of code in your forms application allows you to access the agent:
IDynatrace dynatrace = DependencyService.Get<IDynatrace>();
The only additional functions is the function SetupHttpClient(HttpClient httpClient). Every HttpClient passed to this function will get an additonal handler which will take care of the manual web request instrumentation. All other available functions behave the same as their native counterparts.
Documentation Links
Please look into the platform you want to instrument. Both platforms have different requirements. Also pay attention if you use Dynatrace Appmon or Dynatrace Saas/Managed, they mostly need different configurations.
- AppMon: https://www.dynatrace.com/support/doc/appmon/user-experience-management/mobile-uem/
- Dynatrace: https://www.dynatrace.com/support/help/deploy-dynatrace/oneagent/android/ or https://www.dynatrace.com/support/help/deploy-dynatrace/oneagent/ios/
Troubleshooting and current restrictions
- WebRequests are not automatically instrumented (Android, iOS)
- Lifecycles are tracked but not reported (iOS)
- Some User Actions in iOS are not reported. (e.g. didSelectRowAt)
Changelog
7.2.8:
- Fixed path problem in combination with IntermediateOutputPath
7.2.4 & 7.2.5:
- Fixed Android DataCollection Level
- Fixed Forms Application freeze because of HttpClient instrumentation
7.2.3:
- Fix for applying Android build target automatically
- Changed requirments to .NET Standard 1.1
7.2.1:
- Added support for Xamarin Forms
Product | Versions Compatible and additional computed target framework versions. |
---|---|
.NET | net5.0 was computed. net5.0-windows was computed. net6.0 was computed. net6.0-android was computed. net6.0-ios was computed. net6.0-maccatalyst was computed. net6.0-macos was computed. net6.0-tvos was computed. net6.0-windows was computed. net7.0 was computed. net7.0-android was computed. net7.0-ios was computed. net7.0-maccatalyst was computed. net7.0-macos was computed. net7.0-tvos was computed. net7.0-windows was computed. net8.0 was computed. net8.0-android was computed. net8.0-browser was computed. net8.0-ios was computed. net8.0-maccatalyst was computed. net8.0-macos was computed. net8.0-tvos was computed. net8.0-windows was computed. |
.NET Core | netcoreapp1.0 was computed. netcoreapp1.1 was computed. netcoreapp2.0 was computed. netcoreapp2.1 was computed. netcoreapp2.2 was computed. netcoreapp3.0 was computed. netcoreapp3.1 was computed. |
.NET Standard | netstandard1.1 is compatible. netstandard1.2 was computed. netstandard1.3 was computed. netstandard1.4 was computed. netstandard1.5 was computed. netstandard1.6 was computed. netstandard2.0 was computed. netstandard2.1 was computed. |
.NET Framework | net45 was computed. net451 was computed. net452 was computed. net46 was computed. net461 was computed. net462 was computed. net463 was computed. net47 was computed. net471 was computed. net472 was computed. net48 was computed. net481 was computed. |
MonoAndroid | monoandroid was computed. monoandroid41 is compatible. |
MonoMac | monomac was computed. |
MonoTouch | monotouch was computed. |
Tizen | tizen30 was computed. tizen40 was computed. tizen60 was computed. |
Universal Windows Platform | uap was computed. uap10.0 was computed. |
Windows Phone | wpa81 was computed. |
Windows Store | netcore was computed. netcore45 was computed. netcore451 was computed. |
Xamarin.iOS | xamarinios was computed. xamarinios10 is compatible. |
Xamarin.Mac | xamarinmac was computed. |
Xamarin.TVOS | xamarintvos was computed. |
Xamarin.WatchOS | xamarinwatchos was computed. |
This package has no dependencies.
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.
Version | Downloads | Last updated |
---|---|---|
8.291.1 | 1,277 | 5/24/2024 |
8.289.1 | 1,816 | 4/26/2024 |
8.287.1 | 192 | 4/11/2024 |
8.285.2 | 231 | 3/12/2024 |
8.285.1 | 248 | 3/7/2024 |
8.283.1 | 1,607 | 1/29/2024 |
8.279.1 | 3,952 | 11/24/2023 |
8.277.1 | 2,456 | 10/11/2023 |
8.275.1 | 1,233 | 9/19/2023 |
8.273.2 | 2,234 | 9/8/2023 |
8.273.1 | 709 | 8/23/2023 |
8.271.2 | 93,718 | 7/26/2023 |
8.271.1 | 720 | 7/19/2023 |
8.269.0 | 914 | 6/28/2023 |
8.267.1 | 2,277 | 6/5/2023 |
8.265.1 | 1,443 | 5/3/2023 |
8.263.2 | 1,618 | 4/11/2023 |
8.263.1 | 700 | 4/11/2023 |
8.261.2 | 818 | 4/6/2023 |
8.261.1 | 18,929 | 3/14/2023 |
8.259.2 | 3,421 | 3/1/2023 |
8.259.1 | 11,875 | 2/10/2023 |
8.257.1 | 2,060 | 2/1/2023 |
8.253.1 | 10,898 | 11/3/2022 |
8.249.0 | 3,481 | 9/22/2022 |
8.247.0 | 83,371 | 9/5/2022 |
8.233.0 | 15,193 | 2/11/2022 |
8.225.0 | 18,368 | 8/19/2021 |
8.219.0 | 2,155 | 6/22/2021 |
8.213.0 | 25,163 | 3/9/2021 |
7.2.12 | 9,823 | 8/31/2020 |
7.2.11 | 1,554 | 8/20/2020 |
7.2.10 | 2,574 | 8/5/2020 |
7.2.9 | 13,997 | 3/4/2020 |
7.2.8 | 4,910 | 12/5/2019 |
7.2.5 | 6,504 | 9/27/2019 |
7.2.4 | 1,959 | 8/14/2019 |
7.2.3 | 7,439 | 3/21/2019 |
7.2.1 | 19,435 | 11/23/2018 |