<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: Siddhartha Khare</title>
    <description>The latest articles on DEV Community by Siddhartha Khare (@siddy15).</description>
    <link>https://dev.to/siddy15</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F1131994%2F84e68dfe-9683-4db5-9aac-2ce53d2f8ce0.png</url>
      <title>DEV Community: Siddhartha Khare</title>
      <link>https://dev.to/siddy15</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/siddy15"/>
    <language>en</language>
    <item>
      <title>Optimizing React Native app performance</title>
      <dc:creator>Siddhartha Khare</dc:creator>
      <pubDate>Sat, 09 Sep 2023 17:22:56 +0000</pubDate>
      <link>https://dev.to/newrelic/optimizing-react-native-app-performance-41pf</link>
      <guid>https://dev.to/newrelic/optimizing-react-native-app-performance-41pf</guid>
      <description>&lt;p&gt;To read this full New Relic article, &lt;a href="https://newrelic.com/blog/best-practices/optimizing-react-native-app-performance" rel="noopener noreferrer"&gt;click here&lt;/a&gt;&lt;/p&gt;




&lt;p&gt;React Native is an open-source framework developed by Facebook that enables developers to build mobile applications for iOS, Android, and other platforms using JavaScript and React. React Native allows developers to create native-like apps with a high level of performance while writing most of their codebase in JavaScript, which is familiar to many web developers. React Native uses native components under the hood instead of rendering WebViews like hybrid frameworks, resulting in a better user experience and smoother interactions.&lt;/p&gt;

&lt;p&gt;In the complicated arena of mobile application development, it's the responsibility of product managers and developers to design applications that not only provide impeccable functionality but also provide exceptional performance and a compelling user experience. Comprehensive performance monitoring is essential for accomplishing these demanding goals. By continuously monitoring the app's performance, teams may effectively discover and resolve any underlying issues that may adversely affect the app's overall performance, ensuring that users experience nothing less than excellence.&lt;/p&gt;

&lt;h2&gt;
  
  
  How to get started
&lt;/h2&gt;

&lt;p&gt;Increase the speed of your React Native app analysis and gain valuable insights in under 10 minutes.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Install React Native agent. &lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;New Relic provides an SDK (aka the React Native agent) for your application instrumentation. &lt;br&gt;
To install the SDK, follow these steps:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Add the SDK agent.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Using Yarn:&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;

yarn add newrelic-react-native-agent


&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;Using NPM:&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;

npm i newrelic-react-native-agent


&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;ul&gt;
&lt;li&gt;Initialize React Native agent. In index.js add the following code to launch New Relic:&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;

import NewRelic from 'newrelic-react-native-agent';
import {name, version} from './package.json';
import {Platform} from 'react-native';

    let appToken;

    if (Platform.OS === 'ios') {
        appToken = '&amp;lt;IOS-APP-TOKEN&amp;gt;';
    } else {
        appToken = '&amp;lt;ANDROID-APP-TOKEN&amp;gt;';
    }

 const agentConfiguration = {

    //Android Specific
    // Optional:Enable or disable collection of event data.
    analyticsEventEnabled: true,

    // Optional:Enable or disable crash reporting.
    crashReportingEnabled: true,

    // Optional:Enable or disable interaction tracing. Trace instrumentation still occurs, but no traces are harvested. This will disable default and custom interactions.
    interactionTracingEnabled: true,

    // Optional:Enable or disable reporting successful HTTP requests to the MobileRequest event type.
    networkRequestEnabled: true,

    // Optional:Enable or disable reporting network and HTTP request errors to the MobileRequestError event type.
    networkErrorRequestEnabled: true,

    // Optional:Enable or disable capture of HTTP response bodies for HTTP error traces, and MobileRequestError events.
    httpRequestBodyCaptureEnabled: true,

   // Optional:Enable or disable agent logging.
    loggingEnabled: true,

    // Optional:Specifies the log level. Omit this field for the default log level.
    // Options include: ERROR (least verbose), WARNING, INFO, VERBOSE, AUDIT (most verbose).
    logLevel: NewRelic.LogLevel.INFO,

    // iOS Specific
    // Optional:Enable/Disable automatic instrumentation of WebViews
    webViewInstrumentation: true,

    // Optional:Set a specific collector address for sending data. Omit this field for default address.
    // collectorAddress: "",

    // Optional:Set a specific crash collector address for sending crashes. Omit this field for default address.
    // crashCollectorAddress: "",

    // Optional:Enable or disable reporting data using different endpoints for US government clients
    // fedRampEnabled: false
  };


NewRelic.startAgent(appToken,agentConfiguration);
NewRelic.setJSAppVersion(version);
AppRegistry.registerComponent(name, () =&amp;gt; App);


&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;&lt;strong&gt;Note:&lt;/strong&gt; Don’t forget to put the proper application token(s) for Android and iOS applications.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;&lt;a href="https://docs.newrelic.com/docs/mobile-monitoring/new-relic-mobile-android/install-configure/install-android-apps-gradle-android-studio/" rel="noopener noreferrer"&gt;Install the New Relic native Android agent&lt;/a&gt;. &lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Install the New Relic iOS agent using below command:&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;

npx pod-install


&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;Link the New Relic library to your React Native project and rebuild the application. React Native 0.60+ includes “autolinking” for seamless integration. &lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Android applications autolinking:&lt;/li&gt;
&lt;/ul&gt;

&lt;pre class="highlight plaintext"&gt;&lt;code&gt;

   npx react-native run-android
&lt;/code&gt;&lt;/pre&gt;


&lt;/li&gt;

&lt;/ul&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;   - iOS applications autolinking:

       ```


       cd ios/ 
       pod install –-repo-update
       cd ..
       npx react-native run-ios


&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;ul&gt;
&lt;li&gt;Verify React Native app’s proper function by executing below commands. Fatal JavaScript errors will be visible as crashes in New Relic UI.&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;

npx react-native run-android --variant=release


&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;
&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;

npx react-native run-ios --configuration Release


&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;After instrumenting your React Native app, you can gather key mobile telemetry data, such as crashes, HTTP requests, failures, and events. Use New Relic analytics to improve your app's speed and UX.  Here are few reasons why it's helpful: &lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Data-backed decisions&lt;/strong&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Performance monitoring tools provide deeper insights into problems faced by users. Visualize significant information on user-friendly dashboards, set alerts to refer problems to relevant features, and proactively manage issues.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;JavaScript error insight&lt;/strong&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;The Handled Exceptions page in New Relic reveals JavaScript failures and promise rejections. It displays event trails, attributes, and stack traces for each JavaScript error that has been gathered.&lt;/p&gt;

&lt;p&gt;Use the following query to access these errors, allowing you to create a dashboard for cohesive visualization.&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;

SELECT * FROM MobileHandledException SINCE 24 hours ago

SELECT JSAppVersion, JSEngine, name, exceptionMessage, exceptionCause, isFatal FROM MobileHandledException SINCE 7 DAYS AGO limit MAX


&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fcalidtroqbcejig2em2f.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fcalidtroqbcejig2em2f.png" alt="Handled Exception Summary"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;ANR detection and capture&lt;/strong&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Application not responding (ANR) situations are an unpleasant problem with users that often end up in negative app reviews and ratings. Leading ANR causes include timed-out input dispatch and long-running operations on the main thread. &lt;/p&gt;

&lt;p&gt;The native agent detects &lt;a href="https://developer.android.com/topic/performance/vitals/anr" rel="noopener noreferrer"&gt;ANR&lt;/a&gt; events efficiently, pointing out situations where activities or service threads are obstructed above Android's allowable level. For foreground activities, this threshold is 5 seconds, and for services, it ranges from 5 to 200 seconds. ANR situations, unlike crashes, are reported as &lt;a href="https://docs.newrelic.com/docs/mobile-monitoring/mobile-monitoring-ui/crashes/introduction-mobile-handled-exceptions/" rel="noopener noreferrer"&gt;handled exceptions&lt;/a&gt;. &lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Spotting rooted devices&lt;/strong&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Manufacturers restrict devices for safety reasons, while rooted devices provide administrators complete OS control. A rooted smartphone grants you extra privileges and allows you to customize it, but it can also signal disaster. Some of the potential issues linked with rooted devices include security breaches, data loss, and so on. &lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fpes52567vjy7qqi436th.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fpes52567vjy7qqi436th.png" alt="ANR and Rooted Device Detection"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Breadcrumbs&lt;/strong&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Breadcrumbs are a simplified form of session logging that collects metadata throughout a session and transmits it all at once at the end of the session. This approach minimizes the burden on the device's CPU and RAM, avoids separate network calls, and has no impact on the app's performance. Breadcrumbs can be used to debug crashes, provide insights into user behavior, and track user journeys. &lt;/p&gt;

&lt;p&gt;To use breadcrumbs, add this code to your project:&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;

​​NewRelic.recordBreadcrumb("Start Download Image",{"imageColor":"blue"});


&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;For more details on how to use this method, see &lt;a href="https://docs.newrelic.com/docs/mobile-monitoring/new-relic-mobile/mobile-sdk/record-breadcrumb/" rel="noopener noreferrer"&gt;Record breadcrumbs&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;Once you’ve recorded breadcrumbs, you’ll see them in crash analysis in the UI.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fr4k1we68wzkbe9r1q623.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fr4k1we68wzkbe9r1q623.png" alt="Recorded Breadcrumb"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Service maps&lt;/strong&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Service maps are interactive graphical representations of your architecture. These dynamic maps depict detailed relationships and dependencies within the application, comprising critical pieces like databases, hosts, servers, and external services.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fvpm0g0mgjvw2twza6zd9.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fvpm0g0mgjvw2twza6zd9.png" alt="Graphical representation of your application"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Unveiling memory exhaustion incidents&lt;/strong&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;You can use the New Relic agent to monitor out of memory (OOM) errors, which are caused by insufficient memory. These errors frequently confuse users because they see it as an abrupt app shutdown, similar to a crash. This degrades the user experience, which may result in app abandonment or unfavorable ratings&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F77yud8iywctq1fudy9xb.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F77yud8iywctq1fudy9xb.png" alt="Out-of-Memory Exceptions"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Crash reports&lt;/strong&gt; &lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;This provides insights about the crash happening, including: &lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Granular device and OS breakdown&lt;/li&gt;
&lt;li&gt;App version analytics &lt;/li&gt;
&lt;li&gt;Occurence enumeration&lt;/li&gt;
&lt;li&gt;User impact assessment&lt;/li&gt;
&lt;li&gt;Sequentially delineated crash-related interactions and events &lt;/li&gt;
&lt;li&gt;Curated subsets of incidents&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fmlfsls9bfgr9fzw6r8ie.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fmlfsls9bfgr9fzw6r8ie.png" alt="Crash Summary"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fowclmuqnio0kc34yw04t.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fowclmuqnio0kc34yw04t.png" alt="Crash Stack Trace"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Conclusion
&lt;/h2&gt;

&lt;p&gt;Monitoring React Native mobile applications is more than just a requirement; it is a beneficial, proactive approach. Building an app is merely the first engagement. Your applications achieve a distinctive advantage within a competitive market landscape, potentially enhancing overall business outcomes, through methodical performance monitoring, preemptive issue resolution, and strategic user engagement optimization.&lt;/p&gt;

&lt;p&gt;Read the full blog post at New Relic: &lt;a href="https://newrelic.com/blog/best-practices/optimizing-react-native-app-performance" rel="noopener noreferrer"&gt;Optimizing React Native app performance&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Not an existing New Relic user? &lt;a href="https://newrelic.com/signup" rel="noopener noreferrer"&gt;Sign up for a free account&lt;/a&gt; to get started! 👨‍💻&lt;/p&gt;

</description>
      <category>observability</category>
      <category>newrelic</category>
      <category>reactnative</category>
      <category>mobile</category>
    </item>
    <item>
      <title>Boost UX: Monitor Flutter mobile apps efficiently</title>
      <dc:creator>Siddhartha Khare</dc:creator>
      <pubDate>Fri, 04 Aug 2023 16:40:10 +0000</pubDate>
      <link>https://dev.to/newrelic/boost-ux-monitor-flutter-mobile-apps-efficiently-3nga</link>
      <guid>https://dev.to/newrelic/boost-ux-monitor-flutter-mobile-apps-efficiently-3nga</guid>
      <description>&lt;p&gt;&lt;em&gt;To read this full New Relic article, click &lt;a href="https://newrelic.com/blog/best-practices/flutter-mobile-app-monitoring?utm_source=devto&amp;amp;utm_medium=community&amp;amp;utm_campaign=global-fy24-q2-Boost-UX"&gt;here&lt;/a&gt;.&lt;/em&gt;&lt;/p&gt;




&lt;p&gt;In today's dynamic digital environment, mobile applications have become an indispensable part of our daily lives. While there are many hybrid mobile platforms available, this blog will focus primarily on the Flutter platform.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://flutter.dev/"&gt;Flutter&lt;/a&gt;, a Google-developed open-source User Interface (UI) software development kit, has become highly popular among mobile developers because of its ability to produce robust, cross-platform solutions. However, building a Flutter application is just the start. If you want your app to succeed and keep your user base happy, it is essential to implement a thorough application monitoring system. New Relic can help you do just that!&lt;/p&gt;

&lt;h2&gt;
  
  
  &lt;strong&gt;Prerequisite: Instrument your Flutter mobile app with New Relic&lt;/strong&gt;
&lt;/h2&gt;

&lt;p&gt;To get started monitoring your Flutter mobile app with New Relic, follow these steps: &lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Install the Flutter agent &lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;New Relic provides an SDK (AKA the Flutter agent) for Flutter application instrumentation. To install the SDK, follow these steps:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Add the newrelic_flutter package to your pubspec.yaml file:
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;dependencies:
    newrelic_mobile: 1.0.1
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Make sure to use the latest version of the package:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Run flutter pub get in your project directory to fetch the package.&lt;/li&gt;
&lt;li&gt;Import the newrelic_flutter package in your Flutter application code:
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;import 'package:newrelic_flutter/newrelic_flutter.dart';
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;Initialize the Flutter agent&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;In your Flutter application's entry point (usually main.dart), add the following code to initialize New Relic:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;import 'package:newrelic_mobile/newrelic_mobile.dart';

    var appToken = "";

    if (Platform.isAndroid) {
        appToken = "&amp;lt;android app token&amp;gt;"; // Replace with your application token copied from the New Relic UI. 
    } else if (Platform.isIOS) {
        appToken = "&amp;lt;ios app token&amp;gt;"; // Replace with your application token copied from the New Relic UI. 
    }

    Config config =
        Config(accessToken: appToken,

        //Android Specific
        // Optional: Enable or disable collection of event data.
        analyticsEventEnabled: true,

        // Optional: Enable or disable reporting successful HTTP requests to the MobileRequest event type.
        networkErrorRequestEnabled: true,

        // Optional: Enable or disable reporting network and HTTP request errors to the MobileRequestError event type.
        networkRequestEnabled: true,

        // Optional: Enable or disable crash reporting.
        crashReportingEnabled: true,

        // Optional: Enable or disable interaction tracing. Trace instrumentation still occurs, but no traces are harvested. This will disable default and custom interactions.
        interactionTracingEnabled: true,

        // Optional: Enable or disable capture of HTTP response bodies for HTTP error traces and MobileRequestError events.
        httpResponseBodyCaptureEnabled: true,

        // Optional: Enable or disable agent logging.
        loggingEnabled: true,

        // iOS specific
        // Optional: Enable or disable automatic instrumentation of WebViews
        webViewInstrumentation: true,

        //Optional: Enable or disable Print Statements as Analytics Events
        printStatementAsEventsEnabled : true,

        // Optional: Enable or disable automatic instrumentation of HTTP Request
        httpInstrumentationEnabled:true
        );

    NewrelicMobile.instance.start(config, () {
        runApp(MyApp());
    });

    class MyApp extends StatelessWidget {
    ....
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Make sure to replace your application token(s) in the above code with the token generated at &lt;a href="**https://docs.newrelic.com/docs/mobile-monitoring/new-relic-mobile-flutter/monitor-your-flutter-application/#app-token**"&gt;this step&lt;/a&gt; of the documentation. &lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Note:&lt;/strong&gt; If you are instrumenting both Android and iOS native apps, ensure to create and add both tokens in the code.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Build and deploy your application&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Build your Flutter application as you normally would and deploy it to your desired platform (Android, iOS, or both). The Flutter agent will automatically start collecting performance data and sending it to your New Relic account.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Analyze and view your flutter application data in New Relic
&lt;/li&gt;
&lt;/ul&gt;

&lt;ol&gt;
&lt;li&gt;Login to your New Relic portal.&lt;/li&gt;
&lt;li&gt;Click on &lt;strong&gt;Mobile&lt;/strong&gt;  and select your Flutter
application.&lt;/li&gt;
&lt;li&gt;The &lt;strong&gt;Summary&lt;/strong&gt; page is where you will find the curated 
view of your data over time.&lt;/li&gt;
&lt;/ol&gt;

&lt;blockquote&gt;
&lt;p&gt;After instrumenting your Flutter app, you can gather mobile telemetry data about crashes, HTTP requests, handled exceptions, event trails, and other crucial metrics. Keep reading to learn how you can use New Relic's mobile monitoring features to collect critical performance data and gain valuable insights to improve your app's performance and user experience.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;h3&gt;
  
  
  Detect Performance Bottlenecks
&lt;/h3&gt;

&lt;p&gt;Flutter apps run on various devices and operating systems, each with its own specifications and constraints. Performance bottlenecks must be found to ensure a seamless user experience. Monitoring apps provides real-time information on CPU/memory usage, network requests, and rendering performance. Monitoring this data allows developers to optimize code to handle issues such as UI lags, slow loading, and excessive resource consumption in responsive apps.&lt;/p&gt;

&lt;h3&gt;
  
  
  Track and Debug Errors in Real Time
&lt;/h3&gt;

&lt;p&gt;Despite comprehensive testing and quality assurance, production errors and incidents can occur. Flutter application monitoring tools enable developers to capture and trace errors in real time, providing helpful insights into app stability. With this knowledge, developers can release hotfixes quickly while minimizing any impact on user experience.&lt;/p&gt;

&lt;p&gt;Use New Relic Errors Inbox, our error tracking capability offers a centralized hub, to effortlessly view, prioritize, and resolve errors across the entire application stack. It seamlessly integrates with the mobile UI, streamlining the triaging of mobile errors without requiring any additional workload setup.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--lvDNm8FF--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/9erhtpbstkbotccg9h9v.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--lvDNm8FF--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/9erhtpbstkbotccg9h9v.png" alt="HTTP error summary from Error Inbox" width="800" height="400"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--_b3Ol6tK--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/zwx5zu24lihgrx0wi4vb.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--_b3Ol6tK--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/zwx5zu24lihgrx0wi4vb.png" alt="Detailed stack trace from Error Inbox" width="800" height="441"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  Optimize the User Experience
&lt;/h3&gt;

&lt;p&gt;In the real world, mobile app user interfaces may behave differently on various screen sizes, which can cause  a poor user experience for some users. For instance, text could overflow on an iPhone14 but display correctly on an iPhone14 max. We capture such errors and store them in the mobile Dart Errors table for future iterations. With this data, you can easily pinpoint the issue and fix it, improving the user experience.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s---qO_gftx--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/f1yw9p8n1uixwk5cudzp.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s---qO_gftx--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/f1yw9p8n1uixwk5cudzp.png" alt="iPhone 14" width="746" height="1644"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--vhTGixG5--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/seydl77upmg5pbwxlh6u.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--vhTGixG5--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/seydl77upmg5pbwxlh6u.png" alt="iPhone 14 Max" width="742" height="1636"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;You can use the below query to view the UI Errors Details page, which shows the line of code that is causing errors in your application's UI. To visualize and track these errors in your New Relic’s account you can create a dashboard, which can help you quickly identify and fix the problems.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;FROM `Mobile Dart Errors` SELECT * since 1 week ago

FROM `Mobile Dart Errors` SELECT count(*) FACET deviceManufacturer, reason, stackTrace since 1 week ago
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Note:&lt;/strong&gt; You can also use our awesome pre-built dashboards for &lt;a href="https://newrelic.com/instant-observability/mobile-crash-analytics-quickstart?utm_source=devto&amp;amp;utm_medium=community&amp;amp;utm_campaign=global-fy24-q2-Boost-UX"&gt;mobile crash&lt;/a&gt; and &lt;a href="https://newrelic.com/instant-observability/mobile-network-performance-quickstart?utm_source=devto&amp;amp;utm_medium=community&amp;amp;utm_campaign=global-fy24-q2-Boost-UX"&gt;mobile network analysis&lt;/a&gt;.&lt;/p&gt;

&lt;h3&gt;
  
  
  Utilize Distributed Tracing
&lt;/h3&gt;

&lt;p&gt;Obtain a holistic view of request journeys, commencing from your mobile app and traversing through intricate distributed systems, facilitating comprehensive monitoring and analysis capabilities.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--wcOPcsS8--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/vpmcwy84lv7n810y25ci.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--wcOPcsS8--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/vpmcwy84lv7n810y25ci.png" alt="Distributed tracing view part of New Relic APM" width="800" height="449"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;The goal of distributed tracing is to figure out how the whole system performs across all the different parts like an app, a backend, cloud functions, databases, and so on. In this article, I’m just covering the app and a simple backend, though. In order to figure out how the system performs, we trace the flow of a request from the app to the backend. Based on that data, you should, later on, be able to troubleshoot requests that exhibit high latency or errors.&lt;/p&gt;

&lt;h3&gt;
  
  
  Analyze Event Trails
&lt;/h3&gt;

&lt;p&gt;Delve into the mobile monitoring crash event trail, a comprehensive chronicle unveiling the precise sequence of events leading to app crashes. This unlocks the true essence of the crash event trail and harnesses its invaluable insights by visualizing what caused the crash.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--YkZ3_Kwn--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/gph8790onn3410f1vqed.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--YkZ3_Kwn--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/gph8790onn3410f1vqed.png" alt="Event Trail showing the activity leading up to a application crash" width="800" height="558"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--4zOI0yAo--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/dzv205p9w6awsqj8cmg4.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--4zOI0yAo--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/dzv205p9w6awsqj8cmg4.png" alt="Breadcrumb for navigation activity" width="800" height="174"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  Conclusion
&lt;/h3&gt;

&lt;p&gt;In the ever-evolving realm of mobile app development, Flutter application monitoring emerges as a pivotal game-changer for organizations. It empowers you  to outshine the ordinary and deliver truly exceptional user experiences. By systematically monitoring performance, proactively resolving issues, and optimizing user engagement, your applications gain a competitive edge in a crowded market and ultimately can improve business outcomes.&lt;/p&gt;




&lt;p&gt;&lt;em&gt;Read the full blog post at New Relic: &lt;a href="https://newrelic.com/blog/best-practices/flutter-mobile-app-monitoring?utm_source=devto&amp;amp;utm_medium=community&amp;amp;utm_campaign=global-fy24-q2-Boost-UX"&gt;Boost UX: Monitor Flutter mobile apps efficiently&lt;/a&gt;&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;&lt;em&gt;Not an existing New Relic user? &lt;a href="https://newrelic.com/signup?utm_source=devto&amp;amp;utm_medium=community&amp;amp;utm_campaign=global-fy23-q4-google-cloud-logs-agentless?utm_source=devto&amp;amp;utm_medium=community&amp;amp;utm_campaign=global-fy24-q2-Boost-UX"&gt;Sign up for a free account&lt;/a&gt; to get started! 👨‍💻&lt;/em&gt;&lt;/p&gt;

</description>
      <category>observability</category>
      <category>newrelic</category>
      <category>flutter</category>
      <category>mobile</category>
    </item>
  </channel>
</rss>
