protected override SystemState GetSystemState() { if (cachedStateTime.HasValue && cachedSystemState != null) { if (cachedStateTime.Value + StateCacheTimeToLive > DateTime.UtcNow) { return(cachedSystemState); } else { cachedStateTime = null; } } return(new Toggl.Joey.Bugsnag.Data.SystemState() { FreeMemory = (ulong)AndroidInfo.GetFreeMemory(), Orientation = AndroidInfo.GetOrientation(androidContext), BatteryLevel = AndroidInfo.GetBatteryLevel(androidContext), IsCharging = AndroidInfo.CheckBatteryCharging(androidContext), AvailableDiskSpace = (ulong)AndroidInfo.GetAvailableDiskSpace(), LocationStatus = AndroidInfo.GetGpsStatus(androidContext), NetworkStatus = AndroidInfo.GetNetworkStatus(androidContext), }); }
protected override ApplicationState GetAppState() { if (cachedStateTime.HasValue && cachedAppState != null) { if (cachedStateTime.Value + StateCacheTimeToLive > DateTime.UtcNow) { return(cachedAppState); } else { cachedStateTime = null; } } return(new Toggl.Joey.Bugsnag.Data.ApplicationState() { SessionLength = SessionLength, HasLowMemory = AndroidInfo.CheckMemoryLow(androidContext), InForeground = InForeground, ActivityStack = activityStack.Select((w) => w.Target as Context) .Where((ctx) => ctx != null) .Select((ctx) => ctx.GetType().Name) .ToList(), CurrentActivity = TopActivityName, RunningTime = DateTime.UtcNow - appStartTime, MemoryUsage = AndroidInfo.GetMemoryUsedByApp(), }); }
protected override ApplicationInfo GetAppInfo() { if (appInfo == null) { appInfo = new Toggl.Joey.Bugsnag.Data.ApplicationInfo() { Id = androidContext.PackageName, Package = androidContext.PackageName, Version = AndroidInfo.GetAppVersion(androidContext), Name = AndroidInfo.GetAppName(androidContext), ReleaseStage = ReleaseStage, }; } return(appInfo); }
protected override SystemInfo GetSystemInfo() { if (systemInfo == null) { systemInfo = new Toggl.Joey.Bugsnag.Data.SystemInfo() { Id = DeviceId, Manufacturer = Android.OS.Build.Manufacturer, Model = Android.OS.Build.Model, ScreenDensity = androidContext.Resources.DisplayMetrics.Density, ScreenResolution = AndroidInfo.GetScreenResolution(androidContext), TotalMemory = (ulong)AndroidInfo.GetMemoryAvailable(), OperatingSystem = "android", OperatingSystemVersion = Android.OS.Build.VERSION.Release, ApiLevel = (int)Android.OS.Build.VERSION.SdkInt, IsRooted = AndroidInfo.CheckRoot(), Locale = Java.Util.Locale.Default.ToString(), }; } return(systemInfo); }