dotnet / android

.NET for Android provides open-source bindings of the Android SDK for use with .NET managed languages such as C#
MIT License
1.94k stars 533 forks source link

BOOT_COMPLETED receiver performance issue on Xamarin.Android app vs. Native app #1862

Closed izzyco closed 6 months ago

izzyco commented 6 years ago

Steps to Reproduce

  1. Build and run the Xamarin.Android/Native application once
  2. Remove the application from background
  3. Cold boot the device
  4. The time we are referring to is when the OS initializes and sends out the BOOT_COMPLETED intent and the app receives it and opens ups the MainActivity.

Xamarin.Android App Sample

Native App Sample

Behaviors

The native Android application receives the intent and starts the activity within 7 seconds based off of testing on my device. The Xamarin.Android application takes about 20 seconds, three times as long. We have already enabled AOT and LLVM to increase performance as well.

Current Ask

Is there anything on the roadmap to reduce this startup time or anything else we can do to start the application as soon as possible?

Version Information

Microsoft Visual Studio Enterprise 2017 Version 15.7.2 VisualStudio.15.Release/15.7.2+27703.2018 Microsoft .NET Framework Version 4.7.02556

Installed Version: Enterprise

Visual C++ 2017 00369-60000-00001-AA644 Microsoft Visual C++ 2017

Application Insights Tools for Visual Studio Package 8.12.10405.1 Application Insights Tools for Visual Studio

ASP.NET and Web Tools 2017 15.0.40511.0 ASP.NET and Web Tools 2017

ASP.NET Core Razor Language Services 15.7.31476 Provides languages services for ASP.NET Core Razor.

ASP.NET Web Frameworks and Tools 2017 5.2.60419.0 For additional information, visit https://www.asp.net/

Azure App Service Tools v3.0.0 15.0.40424.0 Azure App Service Tools v3.0.0

Azure Data Lake Node 1.0 This package contains the Data Lake integration nodes for Server Explorer.

Azure Data Lake Tools for Visual Studio 2.3.3000.2 Microsoft Azure Data Lake Tools for Visual Studio

Azure Functions and Web Jobs Tools 15.0.40424.0 Azure Functions and Web Jobs Tools

Azure Stream Analytics Tools for Visual Studio 2.3.3000.2 Microsoft Azure Stream Analytics Tools for Visual Studio

C# Tools 2.8.2-beta6-62916-08. Commit Hash: 2ad4aabc7a9dada097e54e544ebba48ab1c05074 C# components used in the IDE. Depending on your project type and settings, a different version of the compiler may be used.

Common Azure Tools 1.10 Provides common services for use by Azure Mobile Services and Microsoft Azure Tools.

Fabric.DiagnosticEvents 1.0 Fabric Diagnostic Events

JavaScript Language Service 2.0 JavaScript Language Service

JavaScript Project System 2.0 JavaScript Project System

JavaScript UWP Project System 2.0 JavaScript UWP Project System

Merq 1.1.19-rc (a4ffc1b) Command Bus, Event Stream and Async Manager for Visual Studio extensions.

Microsoft Azure HDInsight Azure Node 2.3.3000.2 HDInsight Node under Azure Node

Microsoft Azure Hive Query Language Service 2.3.3000.2 Language service for Hive query

Microsoft Azure Service Fabric Tools for Visual Studio 2.1 Microsoft Azure Service Fabric Tools for Visual Studio

Microsoft Azure Stream Analytics Language Service 2.3.3000.2 Language service for Azure Stream Analytics

Microsoft Azure Stream Analytics Node 1.0 Azure Stream Analytics Node under Azure Node

Microsoft Azure Tools 2.9 Microsoft Azure Tools for Microsoft Visual Studio 2017 - v2.9.10420.2

Microsoft Continuous Delivery Tools for Visual Studio 0.3 Simplifying the configuration of continuous build integration and continuous build delivery from within the Visual Studio IDE.

Microsoft JVM Debugger 1.0 Provides support for connecting the Visual Studio debugger to JDWP compatible Java Virtual Machines

Microsoft MI-Based Debugger 1.0 Provides support for connecting Visual Studio to MI compatible debuggers

Microsoft Visual C++ Wizards 1.0 Microsoft Visual C++ Wizards

Microsoft Visual Studio Tools for Containers 1.1 Develop, run, validate your ASP.NET Core applications in the target environment. F5 your application directly into a container with debugging, or CTRL + F5 to edit & refresh your app without having to rebuild the container.

Microsoft Visual Studio VC Package 1.0 Microsoft Visual Studio VC Package

Mono Debugging for Visual Studio 4.10.5-pre (ab58725) Support for debugging Mono processes with Visual Studio.

NuGet Package Manager 4.6.0 NuGet Package Manager in Visual Studio. For more information about NuGet, visit http://docs.nuget.org/.

ProjectServicesPackage Extension 1.0 ProjectServicesPackage Visual Studio Extension Detailed Info

Redgate ReadyRoll 1.14.17.5347 Extend DevOps processes to your SQL Server databases and safely automate database deployments.

Visit https://www.red-gate.com/readyroll for more information.

Copyright (C) 2011 Red Gate Software Ltd. All rights reserved.

This software contains components from Component Owl. SQL Server is a registered trademark of Microsoft Corporation. Visual Studio is a registered trademark of Microsoft Corporation.

ReadyRoll contains code from the following open source software:

NuGet https://www.nuget.org/ SQL LocalDB Wrapper https://github.com/martincostello/sqllocaldb Autofac https://autofac.org/ Json.NET https://json.net/ MahApps.Metro http://mahapps.com/ SemVer https://github.com/maxhauser/semver Log4Net http://logging.apache.org/log4net/ Extended WPF Toolkit https://wpftoolkit.codeplex.com/ Code InfoBox VSX http://www.codeproject.com/Articles/55196/Code-InfoBox-Visual-Studio-Extension-VSX OctoPack https://github.com/OctopusDeploy/OctoPack SQLite https://sqlite.org/

This product contains icons from http://www.visualpharm.com distributed under a free backlink license.

For license details or other notices relating to the above software, please see NOTICE.TXT and EULA.rtf in the ReadyRoll application folder.

Redgate SQL Prompt 8.2.5.2924 Write, format, and refactor SQL effortlessly

ResourcePackage Extension 1.0 ResourcePackage Visual Studio Extension Detailed Info

SQL Server Data Tools 15.1.61804.210 Microsoft SQL Server Data Tools

ToolWindowHostedEditor 1.0 Hosting json editor into a tool window

TypeScript Tools 15.7.20419.2003 TypeScript Tools for Microsoft Visual Studio

Visual Basic Tools 2.8.2-beta6-62916-08. Commit Hash: 2ad4aabc7a9dada097e54e544ebba48ab1c05074 Visual Basic components used in the IDE. Depending on your project type and settings, a different version of the compiler may be used.

Visual F# Tools 10.1 for F# 4.1 15.7.0.0. Commit Hash: 56f97a8dd4353d897336941f3e644423b87c794f. Microsoft Visual F# Tools 10.1 for F# 4.1

Visual Studio Code Debug Adapter Host Package 1.0 Interop layer for hosting Visual Studio Code debug adapters in Visual Studio

Visual Studio Tools for CMake 1.0 Visual Studio Tools for CMake

Visual Studio Tools for Unity 3.7.0.1 Visual Studio Tools for Unity

Visual Studio Tools for Universal Windows Apps 15.0.27703.2018 The Visual Studio Tools for Universal Windows apps allow you to build a single universal app experience that can reach every device running Windows 10: phone, tablet, PC, and more. It includes the Microsoft Windows 10 Software Development Kit.

VisualStudio.Mac 1.0 Mac Extension for Visual Studio

Windows Machine Learning Generator Extension 1.0 Windows Machine Learning Visual Studio Extension Detailed Info

Xamarin 4.10.0.448 (4373404db) Visual Studio extension to enable development for Xamarin.iOS and Xamarin.Android.

Xamarin Designer 4.12.270 (82d750d12) Visual Studio extension to enable Xamarin Designer tools in Visual Studio.

Xamarin.Android SDK 8.3.0.19 (HEAD/342b2ce96) Xamarin.Android Reference Assemblies and MSBuild support.

Xamarin.iOS and Xamarin.Mac SDK 11.10.1.178 (408d357) Xamarin.iOS and Xamarin.Mac Reference Assemblies and MSBuild support.

Log File

mihirao commented 6 years ago

Hi, I have noticed a delay in the launcher app on our embedded device. Here are the timings that I notice with xamain and native apps:

Xamarin android app Cold boot time : 16sec Boot to home screen : 54sec Time from Home Screen to App: 1min 3 sec.

Native App : Cold boot time : 8 sec Boot to home screen: 58 sec Time from Home Screen to App: 1sec or less .

There is a significant delay when we use the xamain.android app when we launch the app on the bootup.

jonathanpeppers commented 6 years ago

@izhang1 @mihirao so my initial question is there as much of a difference if you take Cold boot the device out of the equation?

Is this issue really just about general startup time?

We have started planning several tasks around startup time: https://github.com/xamarin/xamarin-android/projects/8

I also think that the fix for issue https://github.com/xamarin/xamarin-android/issues/1544 (PR https://github.com/xamarin/xamarin-android/pull/1855) will help.

mihirao commented 6 years ago

Yes, we have noticed so much diffrence between when we launch the xamarin app versus native app after the boot up is completed

izzyco commented 6 years ago

@jonathanpeppers So the cold boot is to initiate the BOOT_COMPLETED intent from the OS to trigger the app to start automatically. If a user opens the application there's no delay between a native and Xamarin.Android app in the sample above.

jpobst commented 6 months ago

With support for Classic Xamarin.Android ended May 1st, 2024, this issue is likely no longer relevant.

If this still persists in .NET 8+, please open a new issue with updated information based on net8.0-android or greater. Please include a link to this issue for context.