c# - App delay in launching the splashscreen in xamarin forms Android how to optimize the startup time
问题描述
I am working on xamarin forms and I am facing issue in app delay in launching, Delay in spashscreen how to figure it out. I reduced some loading time by using "asynchronous". But it still taking 19 secs in debug and 8 secs in release mode.
MainActivity:
public class MainActivity : global::Xamarin.Forms.Platform.Android.FormsAppCompatActivity
{
private string AppId = "6e3837aead704cb38b34985422b4d712";//Androidhockeyapp:created hockey app by using(levevagewinphne@hotmail.com)
protected override void OnCreate(Bundle bundle)
{
try
{
TabLayoutResource = Resource.Layout.Tabbar;
ToolbarResource = Resource.Layout.Toolbar;
base.OnCreate(bundle);
global::Xamarin.Forms.Forms.Init(this, bundle);
InitPlugins(bundle);
LoadApplication(new App());
}
catch (Exception ex)
{
}
}
public async Task InitPlugins(Bundle bundle)
{
try
{
await Task.Run(async () => // by putting this Task.Run only the Activity Indicator is shown otherwise its not shown. So we have added this.
{
//////hockeyApp Collect crash report
//CrashManager.Register(this, AppId);
//////hockeyApp User metrics
//MetricsManager.Register(Application, AppId);
Rg.Plugins.Popup.Popup.Init(this, bundle);
//CrossCurrentActivity.Current.Init(this, bundle);
BarCodes.Init(() => (Activity)Forms.Context);
CachedImageRenderer.Init(true);
//if (Build.VERSION.SdkInt >= BuildVersionCodes.Lollipop)
//{
// Window.ClearFlags(WindowManagerFlags.TranslucentStatus);
// Window.AddFlags(WindowManagerFlags.DrawsSystemBarBackgrounds);
// Window.SetStatusBarColor(Android.Graphics.Color.ParseColor("#454546"));
//}
}).ConfigureAwait(false);
}
catch (Exception ex)
{
}
}
}
解决方案
推荐阅读
- css - 如何在涉及大图像的情况下保持 flexbox 容器 50/50?
- flutter - 如何在flutter中加载存储在SharedPreference中的数据
- django - 如何向 JavaScriptCatalog 视图添加断点?
- android - 使用不同的 ID 和/或密钥重建 apk 文件:本机脚本
- flutter - in_app_purchase purchaseID 不保持不变
- c++ - 在 C++ 中除数时如何获得更准确的结果
- r - 部署到 Google Cloud Run 时 Docker 容器无法启动
- typescript - 具有泛型的类型别名表现出与非泛型类型不同的行为
- html - Div 环绕滚动 Div
- c# - Download large zip file from azure blob and unzip