Skip to content

Xamarin.Android 保活方案, AndroidX 快速实现

Notifications You must be signed in to change notification settings

dorisoy/XF.KeepAlive

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 

Repository files navigation

XF.KeepAlive

Xamarin.Android 保活方案, AndroidX 快速实现

public override void OnCreate()
{
            base.OnCreate();

            AndroidEnvironment.UnhandledExceptionRaiser += AndroidEnvironment_UnhandledExceptionRaiser;
            AppDomain.CurrentDomain.UnhandledException += CurrentDomain_UnhandledException;
            TaskScheduler.UnobservedTaskException += TaskScheduler_UnobservedTaskException;

            //AppUtils
            AppUtils.Init(this);

            //Crash
            CrashHandler.GetInstance().Init(this);

            //1像素广播注册
            KeepManager.GetInstance().RegisterKeep(this);

            //前台服务保活
            StartService(new Intent(this, typeof(ForegroundService)));

            //开启粘性服务进行保活
            StartService(new Intent(this, typeof(StickyService)));

            //使用JobScheduler进行保活
            AliveJobService.StartJob(this);

            //开启保活工作
            StartKeepWork();
}

About

Xamarin.Android 保活方案, AndroidX 快速实现

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages