protected override IMvxPluginConfiguration GetPluginConfiguration(Type plugin) { if (plugin == typeof(MvvmCross.Plugins.DownloadCache.Droid.Plugin)) { var am = ApplicationContext.GetSystemService(Context.ActivityService) as ActivityManager; var memoryInfo = new ActivityManager.MemoryInfo(); if (am == null) { return(base.GetPluginConfiguration(plugin)); } am.GetMemoryInfo(memoryInfo); var mem = Convert.ToInt32(memoryInfo.TotalMem / 100); return(new MvxDownloadCacheConfiguration { MaxFileAge = TimeSpan.MaxValue, MaxFiles = 1000, MaxInMemoryFiles = 20, MaxInMemoryBytes = mem, DisposeOnRemoveFromCache = true, MaxConcurrentDownloads = 10, CacheFolderPath = MvxDownloadCacheConfiguration.Default.CacheFolderPath, CacheName = MvxDownloadCacheConfiguration.Default.CacheName }); } return(base.GetPluginConfiguration(plugin)); }
/// <summary> /// Calculates the total RAM of the device through Android API or /proc/meminfo. /// </summary> /// <param name="c"> - Context object for current running activity. </param> /// <returns> Total RAM that the device has, or DEVICEINFO_UNKNOWN = -1 in the event of an error. </returns> public static long GetTotalMemory(Context c) { // memInfo.totalMem not supported in pre-Jelly Bean APIs. if (Build.VERSION.SdkInt >= BuildVersionCodes.JellyBean) { var memInfo = new ActivityManager.MemoryInfo(); var am = ActivityManager.FromContext(c); am.GetMemoryInfo(memInfo); if (memInfo != null) { return(memInfo.TotalMem); } else { return(Unknown); } } else { long totalMem = Unknown; try { using (var stream = new FileStream("/proc/meminfo", FileMode.Open, FileAccess.Read)) { totalMem = ParseFileForValue("MemTotal", stream); totalMem *= 1024; } } catch (IOException) { } return(totalMem); } }
public static string getAvailMemory(Context context) { ActivityManager am = (ActivityManager)context.GetSystemService(Context.ActivityService); ActivityManager.MemoryInfo mi = new ActivityManager.MemoryInfo(); am.GetMemoryInfo(mi); return(Formatter.FormatFileSize(context, mi.AvailMem));// 将获取的内存大小规格化 }
public long GetAllocatedMemory() { ActivityManager activityManager = ActivityManager.FromContext(Application.Context); var memoryInfo = new ActivityManager.MemoryInfo(); activityManager.GetMemoryInfo(memoryInfo); return(memoryInfo.TotalMem); }
protected override void createApp() { ActivityManager actManager = GetSystemService(ActivityService) as ActivityManager; var memoryInfo = new ActivityManager.MemoryInfo(); actManager.GetMemoryInfo(memoryInfo); //if (memoryInfo.TotalMem < 1536000000) //{ // MedicalConfig.SetVirtualTextureMemoryUsageMode(MedicalConfig.VTMemoryMode.Small); //} //MedicalConfig.PlatformExtraScaling = 0.25f; //OgrePlugin.OgreInterface.CompressedTextureSupport = OgrePlugin.CompressedTextureSupport.None; //OgrePlugin.OgreInterface.InitialClearColor = new Color(0.156f, 0.156f, 0.156f); #if DEBUG Logging.Log.Default.addLogListener(new Logging.LogConsoleListener()); #endif //OtherProcessManager.OpenUrlInBrowserOverride = openUrl; //dl = new ObbDownloader(this); //dl.DownloadSucceeded += Dl_DownloadSucceeded; //dl.DownloadFailed += Dl_DownloadFailed; //dl.DownloadProgressUpdated += Dl_DownloadProgressUpdated; //dl.NeedCellularPermission += Dl_NeedCellularPermission; //String archiveName = null; #if ALLOW_DATA_FILE String testingArtFile = "/storage/emulated/0/AnomalousMedical.dat"; if (File.Exists(testingArtFile)) { archiveName = testingArtFile; } else { #endif //if (dl.AreExpansionFilesDelivered(SucceedIfEmpty)) //{ // archiveName = findExpansionFile(); //} #if ALLOW_DATA_FILE } Logging.Log.Debug("Archive Name {0}", archiveName); #endif app = new GameApp(new Startup()); app.PrimaryArchivePath = "/storage/emulated/0/RpgArt"; app.Initialized += App_Initialized; app.run(); }
private MemoryWatcher() { var activityManager = Application.Context.GetSystemService(Context.ActivityService) as ActivityManager; var memoryInfo = new ActivityManager.MemoryInfo(); activityManager.GetMemoryInfo(memoryInfo); TotalRam = memoryInfo.TotalMem / (1024 * 1024); }
public ulong ConsumedMemory() { // HACK: Quick mem available, should also be looking at Cached, etc... // https://developer.android.com/reference/android/app/ActivityManager.MemoryInfo.html var mi = new ActivityManager.MemoryInfo(); var activityManager = (ActivityManager)Application.Context.GetSystemService(Application.ActivityService); activityManager.GetMemoryInfo(mi); return((ulong)(mi.TotalMem - mi.AvailMem)); }
internal ActivityManager.MemoryInfo GetMemoryInfo() { var activityManager = (ActivityManager)global::Xamarin.Essentials.Platform.AppContext.GetSystemService(Context.ActivityService); if (activityManager != null) { var memoryManager = new ActivityManager.MemoryInfo(); activityManager.GetMemoryInfo(memoryManager); return(memoryManager); } return(null); }
//public override bool DispatchTouchEvent(Android.Views.MotionEvent ev) //{ // if (ev.Action == MotionEventActions.Down) { // Android.Views.View v = CurrentFocus; // if (v != null && v.GetType() != typeof(EditText)) { // Rect outRect = new Rect(); // v.GetGlobalVisibleRect(outRect); // if (!outRect.Contains((int)ev.RawX, (int)ev.RawY)) { // v.ClearFocus(); // InputMethodManager imm = (InputMethodManager)this.GetSystemService(Context.InputMethodService); // imm.HideSoftInputFromWindow(v.WindowToken, 0); // } // } // } // return base.DispatchTouchEvent(ev); //} public string GetMemory() { var activityManager = GetSystemService(Activity.ActivityService) as ActivityManager; ActivityManager.MemoryInfo memoryInfo = new ActivityManager.MemoryInfo(); activityManager.GetMemoryInfo(memoryInfo); double totalUsed = memoryInfo.AvailMem / (1024 * 1024); double totalRam = memoryInfo.TotalMem / (1024 * 1024); return(totalUsed.ToString("f2") + "/" + totalRam.ToString("f2")); }
protected override void createApp() { ActivityManager actManager = GetSystemService(ActivityService) as ActivityManager; var memoryInfo = new ActivityManager.MemoryInfo(); actManager.GetMemoryInfo(memoryInfo); if (memoryInfo.TotalMem < 1536000000) { MedicalConfig.SetVirtualTextureMemoryUsageMode(MedicalConfig.VTMemoryMode.Small); } MedicalConfig.PlatformExtraScaling = 0.25f; OgrePlugin.OgreInterface.CompressedTextureSupport = OgrePlugin.CompressedTextureSupport.None; OgrePlugin.OgreInterface.InitialClearColor = new Color(0.156f, 0.156f, 0.156f); #if DEBUG Logging.Log.Default.addLogListener(new Logging.LogConsoleListener()); #endif OtherProcessManager.OpenUrlInBrowserOverride = openUrl; String archiveName = null; #if ALLOW_DATA_FILE String testingArtFile = "/storage/emulated/0/AnomalousMedical.dat"; if (File.Exists(testingArtFile)) { archiveName = testingArtFile; } else { #endif archiveName = findExpansionFile(); #if ALLOW_DATA_FILE } Logging.Log.Debug("Archive Name {0}", archiveName); #endif anomalousController = new AnomalousController() { PrimaryArchive = archiveName }; anomalousController.OnInitCompleted += HandleOnInitCompleted; //anomalousController.DataFileMissing += HandleDataFileMissing; anomalousController.AddAdditionalPlugins += HandleAddAdditionalPlugins; anomalousController.run(); }
private bool CheckMemoryLow() { try { var am = (ActivityManager)ctx.GetSystemService( Context.ActivityService); var memInfo = new ActivityManager.MemoryInfo(); am.GetMemoryInfo(memInfo); return(memInfo.LowMemory); } catch (Java.Lang.Throwable ex) { Log.WriteLine("Failed to determine low memory state: {0}", ex); return(false); } }
private MemoryWatcher() { var activityManager = Application.Context.GetSystemService(Activity.ActivityService) as ActivityManager; var memoryInfo = new ActivityManager.MemoryInfo(); activityManager.GetMemoryInfo(memoryInfo); var totalRam = memoryInfo.TotalMem / (1024 * 1024); if (totalRam < 1000) { Settings.PullHigherQualityImagesDefault = false; } }
public static void CleanMemory(bool forceClean = false) { if (forceClean) { GC.Collect(); GC.WaitForPendingFinalizers(); return; } var memoryInfo = new ActivityManager.MemoryInfo(); ActivityManager.GetMemoryInfo(memoryInfo); if (memoryInfo.LowMemory) { GC.Collect(); } }
private void CheckDeviceMemory() { var activityManager = GetSystemService(ActivityService) as ActivityManager; var memoryInfo = new ActivityManager.MemoryInfo(); activityManager.GetMemoryInfo(memoryInfo); var totalRam = memoryInfo.TotalMem / 1024 / 1024; if (totalRam <= 2048) { Preferences.Set("DBListImageShow", false); Preferences.Set("DBDetailBackgroundImage", false); } Preferences.Set("CheckInitLowMemory", false); }
public override void OnBackPressed() { MoveTaskToBack(true); LoggingClass.LogInfo("Clicked on back button", screenid); TokenModel devInfo = new TokenModel(); var activityManager = (ActivityManager)this.GetSystemService(Context.ActivityService); ActivityManager.MemoryInfo memInfo = new ActivityManager.MemoryInfo(); activityManager.GetMemoryInfo(memInfo); System.Diagnostics.Debug.WriteLine("GetDeviceInfo - Avail {0} - {1} MB", memInfo.AvailMem, memInfo.AvailMem / 1024 / 1024); System.Diagnostics.Debug.WriteLine("GetDeviceInfo - Low {0}", memInfo.LowMemory); System.Diagnostics.Debug.WriteLine("GetDeviceInfo - Total {0} - {1} MB", memInfo.TotalMem, memInfo.TotalMem / 1024 / 1024); devInfo.AvailableMainMemory = memInfo.AvailMem; devInfo.IsLowMainMemory = memInfo.LowMemory; devInfo.TotalMainMemory = memInfo.TotalMem; }
public static void Log(Context context) { Context = context; ActivityManager manager = (ActivityManager)context.GetSystemService(Context.ActivityService); ActivityManager.MemoryInfo info = new ActivityManager.MemoryInfo(); manager.GetMemoryInfo(info); Console.WriteLine("Memory log (" + DateTime.Now.ToString("T") + ")"); Console.WriteLine("Available: " + info.AvailMem); Console.WriteLine("Low: " + info.LowMemory); Console.WriteLine("Threshold: " + info.Threshold); Console.WriteLine("---------------------------------"); if (timer == null) { timer = new Timer(new TimerCallback(OnTimerCallback), null, 1000, 1000); } }
protected override void OnCreate(Bundle savedInstanceState) { TabLayoutResource = Resource.Layout.Tabbar; ToolbarResource = Resource.Layout.Toolbar; base.OnCreate(savedInstanceState); Xamarin.Essentials.Platform.Init(this, savedInstanceState); global::Xamarin.Forms.Forms.Init(this, savedInstanceState); LoadApplication(new App()); if (ActivityCompat.ShouldShowRequestPermissionRationale(this, Manifest.Permission.AccessFineLocation)) { // Provide an additional rationale to the user if the permission was not granted // and the user would benefit from additional context for the use of the permission. // For example if the user has previously denied the permission. Log.Info(TAG, "Displaying camera permission rationale to provide additional context."); var requiredPermissions = new String[] { Manifest.Permission.AccessFineLocation }; Snackbar.Make(rootLayout, 95, Snackbar.LengthIndefinite) .SetAction("ok", new Action <View>(delegate(View obj) { ActivityCompat.RequestPermissions(this, requiredPermissions, REQUEST_LOCATION); } ) ).Show(); } else { ActivityCompat.RequestPermissions(this, new String[] { Manifest.Permission.Camera }, REQUEST_LOCATION); } ActivityManager activityManager = (ActivityManager)BaseContext.GetSystemService(Context.ActivityService); ActivityManager.MemoryInfo memoryInfo = new ActivityManager.MemoryInfo(); activityManager.GetMemoryInfo(memoryInfo); List <ActivityManager.RunningAppProcessInfo> runningAppProcesses = activityManager.RunningAppProcesses as List <ActivityManager.RunningAppProcessInfo>; }
public static void getMemoryInfo(this ActivityManager manager, ActivityManager.MemoryInfo memoryinfo) { manager.GetMemoryInfo(memoryinfo); }
public PlatformPerformance() { _runtime = Runtime.GetRuntime(); _activityManager = (ActivityManager)Application.Context.GetSystemService("activity"); _memoryInfo = new ActivityManager.MemoryInfo(); }
protected override void OnCreate(Bundle savedInstanceState) { CheckInternetConnection(); Stopwatch st = new Stopwatch(); st.Start(); base.OnCreate(savedInstanceState); SetContentView(Resource.Layout.detailedView); WineBarcode = Intent.GetStringExtra("WineBarcode"); storeid = Intent.GetIntExtra("storeid", 1); ActionBar.SetHomeButtonEnabled(true); ActionBar.SetDisplayHomeAsUpEnabled(true); ServiceWrapper svc = new ServiceWrapper(); ItemDetailsResponse myData = new ItemDetailsResponse(); ItemReviewResponse SkuRating = new ItemReviewResponse(); this.Title = "Wine Details"; commentsview = FindViewById <ListView>(Resource.Id.listView2); TextView WineName = FindViewById <TextView>(Resource.Id.txtWineName); //Assigning values to respected Textfields WineName.Focusable = false; TextView WineProducer = FindViewById <TextView>(Resource.Id.txtProducer); WineProducer.Focusable = false; TextView Vintage = FindViewById <TextView>(Resource.Id.txtVintage); Vintage.Focusable = false; TextView WineDescription = FindViewById <TextView>(Resource.Id.txtWineDescription); WineDescription.Focusable = false; RatingBar AvgRating = FindViewById <RatingBar>(Resource.Id.avgrating); AvgRating.Focusable = false; TextView ErrorDescription = FindViewById <TextView>(Resource.Id.Error); ErrorDescription.Focusable = false; ErrorDescription.Visibility = ViewStates.Invisible; TableRow tr5 = FindViewById <TableRow>(Resource.Id.tableRow5); try { DownloadAsync(this, System.EventArgs.Empty, WineBarcode); myData = svc.GetItemDetails(WineBarcode, storeid).Result; SkuRating = svc.GetItemReviewsByWineBarcode(WineBarcode).Result; ReviewArray = SkuRating.Reviews.ToList(); comments = new reviewAdapter(this, ReviewArray); if (comments.Count == 0) { ErrorDescription.Text = SkuRating.ErrorDescription; ErrorDescription.Visibility = ViewStates.Visible; //AlertDialog.Builder aler = new AlertDialog.Builder(this, Resource.Style.MyDialogTheme); //aler.SetTitle("No Reviews"); //aler.SetMessage("Be the first one to Review"); //aler.SetNegativeButton("Ok", delegate { }); //Dialog dialog = aler.Create(); //dialog.Show(); } else { commentsview.Adapter = comments; } setListViewHeightBasedOnChildren1(commentsview); WineName.Text = myData.ItemDetails.Name; WineName.InputType = Android.Text.InputTypes.TextFlagNoSuggestions; Vintage.Text = myData.ItemDetails.Vintage.ToString(); if (myData.ItemDetails.Producer == null || myData.ItemDetails.Producer == "") { WineProducer.Text = "Not Available"; } else { WineProducer.Text = myData.ItemDetails.Producer; } if (myData.ItemDetails.Description == null || myData.ItemDetails.Description == "") { WineDescription.Text = "Not Available"; } else { WineDescription.Text = myData.ItemDetails.Description; } AvgRating.Rating = (float)myData.ItemDetails.AverageRating; Review edit = new Review() { Barcode = WineBarcode, RatingText = "", PlantFinal = storeid.ToString() }; var tempReview = ReviewArray.Find(x => x.ReviewUserId == Convert.ToInt32(CurrentUser.getUserId())); if (tempReview != null) { edit.RatingText = tempReview.RatingText; } ReviewPopup editPopup = new ReviewPopup(this, edit); RatingBar RatingInput = FindViewById <RatingBar>(Resource.Id.ratingInput); //Taking rating stars input RatingInput.RatingBarChange += editPopup.CreatePopup; var metrics = Resources.DisplayMetrics; var widthInDp = ConvertPixelsToDp(metrics.WidthPixels); var heightInDp = ConvertPixelsToDp(metrics.HeightPixels); HighImageWine = FindViewById <ImageView>(Resource.Id.WineImage); BitmapFactory.Options options = new BitmapFactory.Options { InJustDecodeBounds = false, OutHeight = 75, OutWidth = 75 }; ProgressIndicator.Hide(); LoggingClass.LogInfo("Entered into detail view" + WineBarcode, screenid); Bitmap result = BitmapFactory.DecodeResource(Resources, Resource.Drawable.placeholder_re, options); } catch (Exception exe) { LoggingClass.LogError(exe.Message, screenid, exe.StackTrace.ToString()); AlertDialog.Builder alert = new AlertDialog.Builder(this); alert.SetTitle("Sorry"); alert.SetMessage("We're under maintainence"); alert.SetNegativeButton("Ok", delegate { }); Dialog dialog = alert.Create(); dialog.Show(); } //downloadButton = FindViewById<Button>(Resource.Id.Download); //try //{ // //downloadButton.Enabled = true; // downloadButton.Click += downloadAsync; // //downloadButton.Enabled = false; //} //catch (Exception e) { } st.Stop(); LoggingClass.LogTime("Detail activity", st.Elapsed.TotalSeconds.ToString()); TokenModel devInfo = new TokenModel(); var activityManager = (ActivityManager)this.GetSystemService(Context.ActivityService); ActivityManager.MemoryInfo memInfo = new ActivityManager.MemoryInfo(); activityManager.GetMemoryInfo(memInfo); System.Diagnostics.Debug.WriteLine("GetDeviceInfo - Avail {0} - {1} MB", memInfo.AvailMem, memInfo.AvailMem / 1024 / 1024); System.Diagnostics.Debug.WriteLine("GetDeviceInfo - Low {0}", memInfo.LowMemory); System.Diagnostics.Debug.WriteLine("GetDeviceInfo - Total {0} - {1} MB", memInfo.TotalMem, memInfo.TotalMem / 1024 / 1024); devInfo.AvailableMainMemory = memInfo.AvailMem; devInfo.IsLowMainMemory = memInfo.LowMemory; devInfo.TotalMainMemory = memInfo.TotalMem; }
public override View OnCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { Stopwatch sr = new Stopwatch();; sr.Start(); base.OnCreateView(inflater, container, savedInstanceState); var view = inflater.Inflate(Resource.Layout.LocationLayout, null); Button Top = view.FindViewById <Button>(Resource.Id.btnTop); Button Middle = view.FindViewById <Button>(Resource.Id.btnMiddle); Button Bottom = view.FindViewById <Button>(Resource.Id.btnBottom); var metrics = Resources.DisplayMetrics; int height = metrics.HeightPixels; height = height - (int)((360 * metrics.Density) / 3); height = height / 3; height = height + 2; Top.LayoutParameters.Height = height; Middle.LayoutParameters.Height = height; Bottom.LayoutParameters.Height = height; if (tabName == "Locations") { LoggingClass.LogInfo("Clicked on " + tabName, screenid); try { Top.SetBackgroundResource(Resource.Drawable.wall1); //Top.Text = "Wall"; //Top.SetTextColor(Color.White); // Top.TextSize = 20; Middle.SetBackgroundResource(Resource.Drawable.pp1); //Middle.Text = "Pt. Pleasant Beach"; //Middle.SetTextColor(Color.White); // Middle.TextSize = 20; Bottom.SetBackgroundResource(Resource.Drawable.scacus1); //Bottom.Text = "Secaucus"; //Bottom.SetTextColor(Color.White); // Bottom.TextSize = 20; OnPause(); { } Top.Click += (sender, e) => { ProgressIndicator.Show(_parent); LoggingClass.LogInfo("Clicked on Wall", screenid); var intent = new Intent(Activity, typeof(GridViewActivity)); intent.PutExtra("MyData", "Wall Store"); StartActivity(intent); }; Middle.Click += (sender, e) => { ProgressIndicator.Show(_parent); LoggingClass.LogInfo("Clicked on Point Plesent", screenid); var intent = new Intent(Activity, typeof(GridViewActivity)); intent.PutExtra("MyData", "Point Pleasant Store"); StartActivity(intent); }; Bottom.Click += (sender, e) => { AlertDialog.Builder aler = new AlertDialog.Builder(Activity); aler.SetTitle("Secaucus Store"); aler.SetMessage("Coming Soon!"); aler.SetNegativeButton("Ok", delegate { }); LoggingClass.LogInfo("Clicked on Secaucus", screenid); Dialog dialog = aler.Create(); dialog.Show(); }; } catch (Exception exe) { LoggingClass.LogError(exe.Message, screenid, exe.StackTrace.ToString()); } } if (tabName == "My Hangouts") { LoggingClass.LogInfo("Clicked on " + tabName, screenid); try { Button Bottom1 = view.FindViewById <Button>(Resource.Id.btnBottom1); int height1 = metrics.HeightPixels; height1 = height1 - (int)((360 * metrics.Density) / 4); height1 = height1 / 4; height1 = height1 - 20; Top.LayoutParameters.Height = height1; Middle.LayoutParameters.Height = height1; Bottom.LayoutParameters.Height = height1; Bottom1.LayoutParameters.Height = height1; Top.SetBackgroundResource(Resource.Drawable.mt); //Top.Text = "My Reviews"; //Top.SetTextColor(Color.White); //Top.TextSize = 20; Middle.SetBackgroundResource(Resource.Drawable.mr); //Middle.Text = "My Tastings"; //Middle.SetTextColor(Color.White); //Middle.TextSize = 20; Bottom.SetBackgroundResource(Resource.Drawable.mf); Bottom1.SetBackgroundResource(Resource.Drawable.ms); //Bottom.Text = "My Favorites"; //Bottom.SetTextColor(Color.White); //Bottom.TextSize = 20; if (CurrentUser.getUserId() == "0" || CurrentUser.GetGuestId() != null) { AlertDialog.Builder aler = new AlertDialog.Builder(Activity, Resource.Style.MyDialogTheme); aler.SetTitle("Sorry"); aler.SetMessage("This Feature is available for VIP Users only"); aler.SetPositiveButton("Login", delegate { var intent = new Intent(Activity, typeof(LoginActivity)); StartActivity(intent); }); aler.SetNegativeButton("KnowMore", delegate { var uri = Android.Net.Uri.Parse("https://hangoutz.azurewebsites.net/index.html"); var intent = new Intent(Intent.ActionView, uri); StartActivity(intent); }); aler.SetNeutralButton("Cancel", delegate { }); Dialog dialog1 = aler.Create(); dialog1.Show(); Top.Click += (sender, e) => { Dialog dialog11 = aler.Create(); dialog1.Show(); }; Middle.Click += (sender, e) => { Dialog dialog12 = aler.Create(); dialog1.Show(); }; Bottom.Click += (sender, e) => { Dialog dialog13 = aler.Create(); dialog1.Show(); }; Bottom1.Click += (sender, e) => { Dialog dialog13 = aler.Create(); dialog1.Show(); }; } else { Top.Click += (sender, e) => { ProgressIndicator.Show(_parent); // AndHUD.Shared.Show(_parent, "Loading...", Convert.ToInt32(MaskType.Clear)); LoggingClass.LogInfo("Clicked on My Reviews", screenid); var intent = new Intent(Activity, typeof(MyTastingActivity)); intent.PutExtra("MyData", "My Reviews"); StartActivity(intent); }; Middle.Click += (sender, e) => { ProgressIndicator.Show(_parent); LoggingClass.LogInfo("Clicked on My Tastings", screenid); var intent = new Intent(Activity, typeof(MyReviewActivity)); intent.PutExtra("MyData", "My Tastings"); StartActivity(intent); }; Bottom.Click += (sender, e) => { ProgressIndicator.Show(_parent); LoggingClass.LogInfo("Clicked on My Favorites", screenid); var intent = new Intent(Activity, typeof(MyFavoriteAvtivity)); intent.PutExtra("MyData", "My Favorites"); StartActivity(intent); }; Bottom1.Click += (sender, e) => { //ProgressIndicator.Show(_parent); LoggingClass.LogInfo("Clicked on My Store", screenid); CustomerResponse AuthServ = new CustomerResponse(); int storename = Convert.ToInt32(CurrentUser.GetPrefered()); if (storename == 1) { Intent intent = new Intent(Activity, typeof(GridViewActivity)); intent.PutExtra("MyData", "Wall Store"); ProgressIndicator.Show(Activity); StartActivity(intent); } else if (storename == 2) { Intent intent = new Intent(Activity, typeof(GridViewActivity)); intent.PutExtra("MyData", "Point Pleasant Store"); ProgressIndicator.Show(Activity); StartActivity(intent); } else { AlertDialog.Builder aler = new AlertDialog.Builder(Activity, Resource.Style.MyDialogTheme); //aler.SetTitle("Sorry"); aler.SetMessage("Please Select your preferred store!"); aler.SetNegativeButton("Ok", delegate { }); Dialog dialog1 = aler.Create(); dialog1.Show(); } }; } } catch (Exception exe) { LoggingClass.LogError(exe.Message, screenid, exe.StackTrace.ToString()); } //}; } if (tabName == "Explore") { try { //Top.SetBackgroundResource(Resource.Drawable.myprofile); //Top.Text = "My Profile"; //Top.SetTextColor(Color.White); //Top.TextSize = 20; //Middle.SetBackgroundResource(Resource.Drawable.sfondo_cantine); //Middle.Text = "Wineries/Search Helper"; //Middle.TextSize = 20; //Middle.SetTextColor(Color.White); //Bottom.SetBackgroundResource(Resource.Drawable.sfondo_regioni); //Bottom.Text = "Regions"; //Bottom.TextSize = 20; //Bottom.SetTextColor(Color.White); //Bottom.SetTextAppearance(Resource.Drawable.abc_btn_borderless_material); //Top.Click += (sender, e) => //{ // ProgressIndicator.Show(_parent); // LoggingClass.LogInfo("Clicked on My Profile",screenid); // var intent = new Intent(Activity, typeof(ProfileActivity)); // intent.PutExtra("MyData", "My Profile"); // StartActivity(intent); //}; //Middle.Click += (sender, e) => //{ // AlertDialog.Builder aler = new AlertDialog.Builder(Activity, Resource.Style.MyDialogTheme); // aler.SetTitle("Wineries Section"); // aler.SetMessage("Coming Soon"); // aler.SetNegativeButton("Ok", delegate { }); // LoggingClass.LogInfo("Clicked on Wineries",screenid); // Dialog dialog = aler.Create(); // dialog.Show(); // //var intent = new Intent(Activity, typeof(LandscapeActivity)); // // intent.PutExtra("MyData", "Wineries"); // // StartActivity(intent); // //var intent = new Intent(Activity, typeof(AutoCompleteTextActivity)); // ////intent.PutExtra("MyData", "Wineries"); // //StartActivity(intent); //}; //Bottom.Click += (sender, e) => //{ // AlertDialog.Builder aler = new AlertDialog.Builder(Activity, Resource.Style.MyDialogTheme); // aler.SetTitle("Regions Section"); // aler.SetMessage("Coming Soon"); // aler.SetNegativeButton("Ok", delegate { }); // LoggingClass.LogInfo("Clicked on Regions",screenid); // Dialog dialog = aler.Create(); // dialog.Show(); // //var intent = new Intent(Activity, typeof(PotraitActivity)); // //intent.PutExtra("MyData", "Regions"); // //StartActivity(intent); //}; } catch (Exception exe) { LoggingClass.LogError(exe.Message, screenid, exe.StackTrace.ToString()); } //Top.Dispose(); //Bottom.Dispose(); //Middle.Dispose(); } TokenModel devInfo = new TokenModel(); var activityManager = (ActivityManager)this.Context.GetSystemService(Context.ActivityService); ActivityManager.MemoryInfo memInfo = new ActivityManager.MemoryInfo(); activityManager.GetMemoryInfo(memInfo); System.Diagnostics.Debug.WriteLine("GetDeviceInfo - Avail {0} - {1} MB", memInfo.AvailMem, memInfo.AvailMem / 1024 / 1024); System.Diagnostics.Debug.WriteLine("GetDeviceInfo - Low {0}", memInfo.LowMemory); System.Diagnostics.Debug.WriteLine("GetDeviceInfo - Total {0} - {1} MB", memInfo.TotalMem, memInfo.TotalMem / 1024 / 1024); devInfo.AvailableMainMemory = memInfo.AvailMem; devInfo.IsLowMainMemory = memInfo.LowMemory; devInfo.TotalMainMemory = memInfo.TotalMem; sr.Stop(); LoggingClass.LogTime("tab activity time", sr.Elapsed.TotalSeconds.ToString()); return(view); }
void HandleAndroidException(object sender, RaiseThrowableEventArgs e) { // #if !DEBUG string methodShow = null; string exClass = null; if (e.Exception.TargetSite != null) { methodShow = e.Exception.TargetSite.Name; exClass = e.Exception.TargetSite.DeclaringType.FullName; } string userInfo = null; if (User.Singleton != null) { userInfo = "userID = " + User.Singleton.Id + ";\r\nmail=" + User.Singleton.Email + ";\r\nkey=" + User.Singleton.HashKey; } var activityManager = GetSystemService(Activity.ActivityService) as ActivityManager; ActivityManager.MemoryInfo memoryInfo = new ActivityManager.MemoryInfo(); activityManager.GetMemoryInfo(memoryInfo); double totalUsed = memoryInfo.AvailMem / (1024 * 1024); double totalRam = memoryInfo.TotalMem / (1024 * 1024); e.Handled = true; //AppsLog.SendLog(new AppsLog { // SystemName = Device.OS.ToString(), // DeviceModel = Android.OS.Build.Model, // SystemVersion = Android.OS.Build.VERSION.Sdk, // ExceptionType = e.Exception.GetType().ToString(), // StackTrace = e.Exception.StackTrace, // Message = e.Exception.Message, // AdditionalData = "", // AppVersion = appVersion, // AppFunction = exClass + "." + methodShow, // SizeMemory = totalUsed.ToString("f2") + "/" + totalRam.ToString("f2"), // TypeError = "TypeApplication", // UserId = User.Singleton == null ? 0 : User.Singleton.Id, // UseKey = User.Singleton?.HashKey, // UrlApp = "", // UrlData = "", // UrlMethod = "", //} //); string pageHistory; if (OnePage.redirectApp != null) { pageHistory = OnePage.redirectApp.GetHistoryToJson(); } else { pageHistory = "нету"; } AppsLog.SendLog(new Dictionary <string, string> () { { "system_name", Device.OS.ToString() }, { "device_model", Android.OS.Build.Model }, { "system_version", Android.OS.Build.VERSION.Sdk }, { "exception_type", e.Exception.GetType().ToString() }, { "stack_trace", e.Exception.StackTrace }, { "message", e.Exception.Message }, { "additional_data", @""" """ }, { "page_history", pageHistory }, { "app_version", App.Version }, { "app_function", exClass + "." + methodShow }, { "size_memory", totalUsed.ToString("f2") + "/" + totalRam.ToString("f2") }, { "type_error", "TypeApplication" }, { "user_id", User.Singleton == null ? "0" : User.Singleton.Id.ToString() }, { "user_key", User.Singleton?.HashKey }, { "url", "" }, { "url_data", "" }, { "url_method", "" }, }); }