Skip to content

Commit

Permalink
background reporting (#31)
Browse files Browse the repository at this point in the history
* fix: Analytics controller is not initialized when activity resumes in MAUI Android

* feat:added backgroundReporting and NewEventSystem Configuration

* Update CHANGELOG.md
  • Loading branch information
ndesai-newrelic authored Jun 3, 2024
1 parent 3634150 commit 0bb3b5c
Show file tree
Hide file tree
Showing 35 changed files with 577 additions and 326 deletions.
20 changes: 19 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,23 @@
# Changelog

# 1.0.0

* Improvements

The native iOS Agent has been updated to version 7.4.12, bringing performance enhancements and bug fixes.

* New Features

A new backgroundReportingEnabled feature flag has been introduced to enable background reporting functionality.
A new newEventSystemEnabled feature flag has been added to enable the new event system.



# 0.0.9

- Addressed a problem where the MAUI agent failed to start when the application transitioned from the foreground to the background state, ensuring that the agent now initializes correctly in such scenarios.


# 0.0.7

- Updated native iOS Agent: We've upgraded the native iOS agent to version 7.4.10, which includes performance improvements and bug fixes.
Expand Down Expand Up @@ -41,4 +59,4 @@ The mobile agent team is proud to announce GA support for our .NET MAUI agent!
- Capture C# errors and crashes to quickly identify and fix problems
- Track network requests to see how your app is interacting with the backend
- Use distributed tracing to drill down into handled exceptions and identify the root cause of problems
- Create custom tracking events and metrics to fully understand how your users are interacting with your app
- Create custom tracking events and metrics to fully understand how your users are interacting with your app
Binary file not shown.
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
<PackageRequireLicenseAcceptance>true</PackageRequireLicenseAcceptance>
<Authors>New Relic</Authors>
<PackageTags>newrelic;MAUI;android;new relic;observability;monitoring;telemetry</PackageTags>
<Version>7.3.0</Version>
<Version>7.3.2</Version>
<GeneratePackageOnBuild>true</GeneratePackageOnBuild>
</PropertyGroup>
<ItemGroup>
Expand All @@ -25,4 +25,7 @@
<ItemGroup>
<None Remove="Jars\" />
</ItemGroup>
<ItemGroup>
<Folder Include="Jars\" />
</ItemGroup>
</Project>
25 changes: 25 additions & 0 deletions NewRelic.MAUI.Android.Binding/NewRelic.MAUI.Android.Binding.sln
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Version 16
VisualStudioVersion = 25.0.1706.10
MinimumVisualStudioVersion = 10.0.40219.1
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "NewRelic.MAUI.Android.Binding", "NewRelic.MAUI.Android.Binding.csproj", "{333253D9-59A3-488D-9AB0-A5A941AB60F0}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Release|Any CPU = Release|Any CPU
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{333253D9-59A3-488D-9AB0-A5A941AB60F0}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{333253D9-59A3-488D-9AB0-A5A941AB60F0}.Debug|Any CPU.Build.0 = Debug|Any CPU
{333253D9-59A3-488D-9AB0-A5A941AB60F0}.Release|Any CPU.ActiveCfg = Release|Any CPU
{333253D9-59A3-488D-9AB0-A5A941AB60F0}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {941786DC-A419-4354-954D-637A9D162820}
EndGlobalSection
EndGlobal
10 changes: 5 additions & 5 deletions NewRelic.MAUI.Plugin/NewRelic.MAUI.Plugin.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
<SingleProject>true</SingleProject>
<ImplicitUsings>enable</ImplicitUsings>
<PackageId>NewRelic.MAUI.Plugin</PackageId>
<Version>0.0.7</Version>
<Version>1.0.0</Version>
<Summary>New Relic Plugin for .NET MAUI mobile apps</Summary>
<Description>With the New Relic .NET MAUI mobile plugin, your team can monitor the performance of .NET MAUI apps and identify code errors. The plugin collects crash data, network traffic, and other information for your apps using native components.</Description>
<Authors>New Relic</Authors>
Expand All @@ -31,10 +31,10 @@
<ItemGroup>
<Folder Include="Shared\" />
</ItemGroup>
<ItemGroup Condition="'$(TargetFramework)' == 'net7.0-android'">
<PackageReference Include="NewRelic.MAUI.Android.Binding" Version="7.3.0" />
</ItemGroup>
<ItemGroup Condition="'$(TargetFramework)' == 'net7.0-ios'">
<PackageReference Include="NewRelic.MAUI.iOS.Binding" Version="7.4.10" />
<PackageReference Include="NewRelic.MAUI.iOS.Binding" Version="7.4.12" />
</ItemGroup>
<ItemGroup Condition="'$(TargetFramework)' == 'net7.0-android'">
<PackageReference Include="NewRelic.MAUI.Android.Binding" Version="7.3.2" />
</ItemGroup>
</Project>
25 changes: 25 additions & 0 deletions NewRelic.MAUI.Plugin/NewRelic.MAUI.Plugin.sln
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Version 16
VisualStudioVersion = 25.0.1706.10
MinimumVisualStudioVersion = 10.0.40219.1
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "NewRelic.MAUI.Plugin", "NewRelic.MAUI.Plugin.csproj", "{39628EC8-8298-4582-B149-4C7A13A90941}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Release|Any CPU = Release|Any CPU
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{39628EC8-8298-4582-B149-4C7A13A90941}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{39628EC8-8298-4582-B149-4C7A13A90941}.Debug|Any CPU.Build.0 = Debug|Any CPU
{39628EC8-8298-4582-B149-4C7A13A90941}.Release|Any CPU.ActiveCfg = Release|Any CPU
{39628EC8-8298-4582-B149-4C7A13A90941}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {FF8BB316-158C-4BA2-9B98-908EF05388D5}
EndGlobalSection
EndGlobal
Original file line number Diff line number Diff line change
Expand Up @@ -127,8 +127,6 @@ public void Start(string applicationToken, AgentStartConfiguration agentConfig =
}

newRelic.Start(global::Android.App.Application.Context);
// Temporary workaround, will be fixed in next Android agent release.
Com.Newrelic.Agent.Android.Background.ApplicationStateMonitor.Instance.ActivityStarted();
isStarted = true;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,26 @@ public void Start(string applicationToken, AgentStartConfiguration agentConfig =
{
NRIosAgent.DisableFeatures(iOS.NewRelic.NRMAFeatureFlags.OfflineStorage);
}

if (agentConfig.newEventSystemEnabled)
{
NRIosAgent.EnableFeatures(iOS.NewRelic.NRMAFeatureFlags.NewEventSystem);
}
else
{
NRIosAgent.DisableFeatures(iOS.NewRelic.NRMAFeatureFlags.NewEventSystem);
}


if (agentConfig.backgroundReportingEnabled)
{
NRIosAgent.EnableFeatures(iOS.NewRelic.NRMAFeatureFlags.BackgroundReporting);
}
else
{
NRIosAgent.DisableFeatures(iOS.NewRelic.NRMAFeatureFlags.BackgroundReporting);
}




Expand Down
16 changes: 15 additions & 1 deletion NewRelic.MAUI.Plugin/Shared/AgentStartConfiguration.cs
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,16 @@ public class AgentStartConfiguration
/// </summary>
public bool offlineStorageEnabled = true;

/// <summary> Enable or disable to use our new, more stable, event system for iOS agent.
/// iOS Specific
/// <c>true</c>
/// </summary>
public Boolean newEventSystemEnabled = true;

/// <summary> Enable or disable Background Events Reporting When app is in background.
/// <c>true</c>
/// </summary>
public Boolean backgroundReportingEnabled = false;

/// <summary>
/// Initialize the AgentStartConfiguration with default settings.
Expand All @@ -94,11 +104,13 @@ public AgentStartConfiguration()
/// <param name="webViewInstrumentation">Enable/Disable automatic instrumentation of WebViews.</param>
/// <param name="fedRampEnabled">Enable or disable reporting data using different endpoints for US government clients</param>
/// <param name="offlineStorageEnabled">Enable or disable offline data storage when no internet connection is available.</param>
/// <param name="newEventSystemEnabled">Enable or disable to use our new, more stable, event system for iOS agent.</param>
/// <param name="backgroundReportingEnabled">Enable or disable Background Events Reporting When app is in background.</param>


public AgentStartConfiguration(bool crashReportingEnabled = true, bool loggingEnabled = true, LogLevel logLevel = LogLevel.INFO, string collectorAddress = "DEFAULT",
string crashCollectorAddress = "DEFAULT", bool analyticsEventEnabled = true, bool networkErrorRequestEnabled = true, bool networkRequestEnabled = true,
bool interactionTracingEnabled = false, bool webViewInstrumentation = true, bool fedRampEnabled = false, bool offlineStorageEnabled = true)
bool interactionTracingEnabled = false, bool webViewInstrumentation = true, bool fedRampEnabled = false, bool offlineStorageEnabled = true, bool backgroundReportingEnabled = false,bool newEventSystemEnabled = true)
{
this.crashReportingEnabled = crashReportingEnabled;
this.loggingEnabled = loggingEnabled;
Expand All @@ -112,6 +124,8 @@ public AgentStartConfiguration(bool crashReportingEnabled = true, bool loggingEn
this.webViewInstrumentation = webViewInstrumentation;
this.fedRampEnabled = fedRampEnabled;
this.offlineStorageEnabled = offlineStorageEnabled;
this.newEventSystemEnabled = newEventSystemEnabled;
this.backgroundReportingEnabled = backgroundReportingEnabled;
}
}
}
Expand Down
5 changes: 4 additions & 1 deletion NewRelic.MAUI.iOS.Binding/NewRelic.MAUI.iOS.Binding.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<ImplicitUsings>true</ImplicitUsings>
<PackageId>NewRelic.MAUI.iOS.Binding</PackageId>
<Authors>New Relic</Authors>
<Version>7.4.10</Version>
<Version>7.4.12</Version>
<IsBindingProject>true</IsBindingProject>
<summary>NewRelic iOS SDK binding for .NET MAUI</summary>
<description>A .NET iOS library that binds the native New Relic iOS SDK. With NewRelic, you can collect crashes, network traffic, and other information for .NET MAUI iOS apps using native components.</description>
Expand Down Expand Up @@ -35,4 +35,7 @@
</WeakFrameworks>
</NativeReference>
</ItemGroup>
<ItemGroup>
<Content Include="NewRelic.xcframework\.DS_Store" />
</ItemGroup>
</Project>
14 changes: 7 additions & 7 deletions NewRelic.MAUI.iOS.Binding/NewRelic.xcframework/Info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -5,33 +5,33 @@
<key>AvailableLibraries</key>
<array>
<dict>
<key>DebugSymbolsPath</key>
<string>dSYMs</string>
<key>LibraryIdentifier</key>
<string>ios-arm64</string>
<string>ios-arm64_x86_64-simulator</string>
<key>LibraryPath</key>
<string>NewRelic.framework</string>
<key>SupportedArchitectures</key>
<array>
<string>arm64</string>
<string>x86_64</string>
</array>
<key>SupportedPlatform</key>
<string>ios</string>
<key>SupportedPlatformVariant</key>
<string>simulator</string>
</dict>
<dict>
<key>DebugSymbolsPath</key>
<string>dSYMs</string>
<key>LibraryIdentifier</key>
<string>ios-arm64_x86_64-simulator</string>
<string>ios-arm64</string>
<key>LibraryPath</key>
<string>NewRelic.framework</string>
<key>SupportedArchitectures</key>
<array>
<string>arm64</string>
<string>x86_64</string>
</array>
<key>SupportedPlatform</key>
<string>ios</string>
<key>SupportedPlatformVariant</key>
<string>simulator</string>
</dict>
</array>
<key>CFBundlePackageType</key>
Expand Down
Binary file not shown.
Binary file not shown.
Loading

0 comments on commit 0bb3b5c

Please sign in to comment.