protected override void OnCreate(Bundle savedInstanceState) { base.OnCreate(savedInstanceState); // Set our view from the "main" layout resource SetContentView(Resource.Layout.activity_main); btn_auth_form = FindViewById <Button>(Resource.Id.btn_auth_form); btn_reg_form = FindViewById <Button>(Resource.Id.btn_reg_form); btn_box_form = FindViewById <Button>(Resource.Id.btn_box_form); Dexter.WithActivity(this) .WithPermission(Manifest.Permission.AccessFineLocation) .WithListener(new CompositePermissionListener(new SamplePermissionListener(this))).Check(); // Переход к форме регистрации. btn_reg_form.Click += (s, e) => { Intent registerActivity = new Intent(this, typeof(Auth.RegisterActivity)); StartActivity(registerActivity); }; // Переход к форме авторизация. btn_auth_form.Click += (s, e) => { Intent authActivity = new Intent(this, typeof(Auth.AuthActivity)); StartActivity(authActivity); }; // Переход к регистрации контейнера. btn_box_form.Click += (s, e) => { Intent registerBoxActivity = new Intent(this, typeof(Auth.RegisterActivity)); StartActivity(registerBoxActivity); }; }
protected override void OnCreate(Bundle savedInstanceState) { base.OnCreate(savedInstanceState); Xamarin.Essentials.Platform.Init(this, savedInstanceState); // Set our view from the "main" layout resource SetContentView(P6Test.Resource.Layout.TestLocation); Plugin.CurrentActivity.CrossCurrentActivity.Current.Init(this, bundle); Instance = this; fusedLocationProviderClient = LocationServices.GetFusedLocationProviderClient(this); Dexter.WithActivity(this) .WithPermission(Manifest.Permission.AccessFineLocation) .WithListener(this) .Check(); CreateNotificationChannel(); Intent StartServiceIntent = new Intent(this, typeof(ForegroundMethod)); StartServiceIntent.SetAction("Service.action.START_SERVICE"); StartForegroundService(StartServiceIntent); /*FindViewById<Button>(P6Test.Resource.Id.LocationBtn).Click += (o, e) => * { * getLocation(); * }; * * FindViewById<Button>(P6Test.Resource.Id.resetButton).Click += (o, e) => * { * i = 0; * }; */ }
//private Button urlButton; protected override void OnCreate(Bundle savedInstanceState) { base.OnCreate(savedInstanceState); Xamarin.Essentials.Platform.Init(this, savedInstanceState); // Set our view from the "main" layout resource SetContentView(Resource.Layout.activity_main); //Init view txtResult = FindViewById <TextView>(Resource.Id.txt_result); scannerView = FindViewById <ZXingScannerView>(Resource.Id.zxscan); open_link_button = FindViewById <Button>(Resource.Id.link_button); break_button = FindViewById <Button>(Resource.Id.break_button); //urlButton = FindViewById<Button>(Resource.Id.url_button); //Request permission Dexter.WithActivity(this) .WithPermission(Manifest.Permission.Camera) .WithListener(this) .Check(); open_link_button.Click += (sender, e) => { if (UrlString != "") { Xamarin.Essentials.Browser.OpenAsync(UrlString); } }; break_button.Click += (sender, e) => { scannerView.SetResultHandler(new MyResultHandler(this)); scannerView.StartCamera(); }; }
protected override void OnCreate(Bundle savedInstanceState) { base.OnCreate(savedInstanceState); SetContentView(Resource.Layout.Camera); scannerView = FindViewById <ZXingScannerView>(Resource.Id.zxscan); Dexter.WithActivity(this) .WithPermission(Manifest.Permission.Camera) .WithListener(this) .Check(); }
protected async override void OnCreate(Bundle savedInstanceState) { base.OnCreate(savedInstanceState); SetContentView(Resource.Layout.activity_stats); this.Window.AddFlags(WindowManagerFlags.DrawsSystemBarBackgrounds); this.Window.ClearFlags(WindowManagerFlags.TranslucentStatus); this.Window.SetStatusBarColor(Android.Graphics.Color.ParseColor("#204060")); var toolbar = FindViewById <Toolbar>(Resource.Id.toolbarstats); SetSupportActionBar(toolbar); toolbar.SetNavigationOnClickListener(this); SupportActionBar.SetDisplayHomeAsUpEnabled(true); SupportActionBar.SetDisplayShowHomeEnabled(true); toolbar.NavigationIcon.SetColorFilter(Android.Graphics.Color.ParseColor("#04040C"), PorterDuff.Mode.SrcAtop); statstype = FindViewById <TextView>(Resource.Id.statstype); statsdata = FindViewById <TextView>(Resource.Id.statsdata); generatePDF = FindViewById <Button>(Resource.Id.generatePDF); showbarchart = FindViewById <ImageView>(Resource.Id.showbarchart); showbarchart.Click += Showbarchart_Click; showpiechart = FindViewById <ImageView>(Resource.Id.showpiechart); showpiechart.Click += Showpiechart_Click; analysistype = FindViewById <TextView>(Resource.Id.analysistype); analysistype.Text = "Category-wise Expenses"; //chartview = FindViewById<ChartView>(Resource.Id.chartview); monthcontainer = FindViewById <RelativeLayout>(Resource.Id.monthcontainer); progressBarStats = FindViewById <ProgressBar>(Resource.Id.progressBarStats); rootView = FindViewById <CoordinatorLayout>(Resource.Id.rootView); monthspinner = FindViewById <Spinner>(Resource.Id.monthspinner); CurrentUserUid = Intent.GetStringExtra("CurrentUserUid"); SelectedYear = Intent.GetStringExtra("SelectedYear"); SelectedMonth = Intent.GetStringExtra("SelectedMonth"); CurrentUserDisplayName = Intent.GetStringExtra("CurrentUserDisplayName"); prefs = PreferenceManager.GetDefaultSharedPreferences(this); //statstype.Text = "Total expense for the year"+"("+ SelectedYear+")"; piechartStats = FindViewById <MikePhil.Charting.Charts.PieChart>(Resource.Id.piechartStats); piechartStats.SetNoDataText(""); barchartStats = FindViewById <MikePhil.Charting.Charts.BarChart>(Resource.Id.barchartStats); barchartStats.SetNoDataText(""); barchartStats.Description.Enabled = false; barchartStats.AxisRight.SetDrawLabels(false); database = AppDataHelper.GetDatabase(); IsPieChartSeleted = true; SetupMonthSpinner(); //FetchExpensesTableForMonth(); // await Common.WriteFileToStorageAsync(this, "PlayfairDisplay-Regular.ttf"); await Common.WriteFileToStorageAsync(this, "nunitosans.ttf"); Dexter.WithActivity(this).WithPermission(Android.Manifest.Permission.WriteExternalStorage).WithListener(this).Check(); generatePDF.Click -= GeneratePDF_Click; generatePDF.Click += GeneratePDF_Click; }
protected override void OnCreate(Bundle savedInstanceState) { base.OnCreate(savedInstanceState); // Set our view from the "main" layout resource SetContentView(Resource.Layout.activity_main); btn_all_permission = FindViewById <Button>(Resource.Id.all_permissions_button); btn_camera_permission = FindViewById <Button>(Resource.Id.camera_permission_button); btn_contact_permission = FindViewById <Button>(Resource.Id.contacts_permission_button); btn_audio_permission = FindViewById <Button>(Resource.Id.audio_permission_button); txt_audio_permission = FindViewById <TextView>(Resource.Id.audio_permission_feedback); txt_camera_permission = FindViewById <TextView>(Resource.Id.camera_permission_feedback); txt_contact_permission = FindViewById <TextView>(Resource.Id.contacts_permission_feedback); btn_all_permission.Click += delegate { Dexter.WithActivity(this) .WithPermissions(Manifest.Permission.Camera, Manifest.Permission.ReadContacts, Manifest.Permission.RecordAudio) .WithListener(new CompositeMultiplePermissionsListener(new SampleMultiplePermissionListener(this))) .WithErrorListener(new SampleErrorListener()) .Check(); }; btn_contact_permission.Click += delegate { Dexter.WithActivity(this) .WithPermission(Manifest.Permission.ReadContacts) .WithListener(new CompositePermissionListener(new SamplePermissionListener(this))) .Check(); }; btn_camera_permission.Click += delegate { Dexter.WithActivity(this) .WithPermission(Manifest.Permission.Camera) .WithListener(new CompositePermissionListener(new SamplePermissionListener(this))) .Check(); }; btn_audio_permission.Click += delegate { Dexter.WithActivity(this) .WithPermission(Manifest.Permission.RecordAudio) .WithListener(new CompositePermissionListener(new SamplePermissionListener(this))) .Check(); }; }
protected override void OnCreate(Bundle savedInstanceState) { nrPunktu = Intent.GetStringExtra("nrPunktu"); base.OnCreate(savedInstanceState); SetContentView(Resource.Layout.qrakcja_); // Create your application here scannerView = FindViewById <ZXingScannerView>(Resource.Id.zxcan); Dexter.WithActivity(this) .WithPermission(Manifest.Permission.Camera) .WithListener(this) .Check(); }
public void StartGeofence(string Id, double fromLat, double fromLng, double tooLat, double toLng, double radius) { gefenceModel = new GefenceModel(); gefenceModel.FromLat = fromLat; gefenceModel.FromLng = fromLng; gefenceModel.ToLat = tooLat; gefenceModel.ToLng = toLng; gefenceModel.Status = "From"; gefenceModel.Radius = radius; Dexter.WithActivity(MainActivity) .WithPermission(Manifest.Permission.AccessFineLocation) .WithListener(this) .Check(); }
public void StartGeofence(OrderMobile orderMobile) { if (gefenceModel == null) { gefenceModel = new GefenceModel(); } gefenceModel.OrderMobile = orderMobile; gefenceModel.OnePointForAddressOrder = orderMobile.OnePointForAddressOrders[0]; gefenceModel.IsNewOrder = false; Dexter.WithActivity(MainActivity.GetInstance()) .WithPermission(Manifest.Permission.AccessFineLocation) .WithListener(this) .Check(); }
protected override void OnCreate(Bundle savedInstanceState) { base.OnCreate(savedInstanceState); SetContentView(Resource.Layout.RegisterScreen); Instance = this; //Location setup Dexter.WithActivity(this) .WithPermission(Manifest.Permission.AccessFineLocation) .WithListener(this) .Check(); initialization(); }
protected async override void OnCreate(Bundle savedInstanceState) { base.OnCreate(savedInstanceState); Xamarin.Essentials.Platform.Init(this, savedInstanceState); // Set our view from the "main" layout resource SetContentView(Resource.Layout.activity_main); btn_create_pdf = FindViewById <Button>(Resource.Id.btn_create_pdf); await Common.Common.WriteFileToStorageAsync(this, "brandon_med.otf"); Dexter.WithActivity(this) .WithPermission(Manifest.Permission.WriteExternalStorage) .WithListener(this) .Check(); }
protected override void OnCreate(Bundle savedInstanceState) { try { base.OnCreate(savedInstanceState); // Set our view from the "main" layout resource SetContentView(Resource.Layout.activity_main); string dir_path = System.Environment.GetFolderPath(System.Environment.SpecialFolder.Personal); string file_data_remember; btn_auth_form = FindViewById <Button>(Resource.Id.btn_auth_form); btn_reg_form = FindViewById <Button>(Resource.Id.btn_reg_form); btn_calculator = FindViewById <Button>(Resource.Id.btn_calculator); string[] permissions = { Manifest.Permission.AccessFineLocation, Manifest.Permission.WriteExternalStorage }; ActivityCompat.RequestPermissions(this, new String[] { Manifest.Permission.Camera }, MY_PERMISSIONS_REQUEST_CAMERA); Dexter.WithActivity(this).WithPermissions(permissions).WithListener(new CompositeMultiplePermissionsListener(new SamplePermissionListener(this))).Check(); // Переход к форме регистрации. btn_reg_form.Click += (s, e) => { Intent registerActivity = new Intent(this, typeof(Auth.RegisterActivity)); StartActivity(registerActivity); }; // Переход к форме авторизация btn_auth_form.Click += (s, e) => { Intent authActivity = new Intent(this, typeof(Auth.AuthActivity)); StartActivity(authActivity); }; btn_calculator.Click += (s, e) => { Intent activityApplication = new Intent(this, typeof(Auth.ActivityApplication)); StartActivity(activityApplication); }; } catch (Exception ex) { Toast.MakeText(this, "" + ex.Message, ToastLength.Long).Show(); } }
protected override void OnCreate(Bundle savedInstanceState) { TabLayoutResource = Resource.Layout.Tabbar; ToolbarResource = Resource.Layout.Toolbar; base.OnCreate(savedInstanceState); Xamarin.FormsMaps.Init(this, savedInstanceState); Xamarin.FormsGoogleMaps.Init(this, savedInstanceState); Xamarin.Essentials.Platform.Init(this, savedInstanceState); global::Xamarin.Forms.Forms.Init(this, savedInstanceState); Instance = this; LoadApplication(new App()); if (Connectivity.NetworkAccess != NetworkAccess.Internet) { return; } //SetContentView(Resource.Layout.main) // Intent intent = new Intent(); // intent.SetClass(this,PrevActivity); gso = new GoogleSignInOptions.Builder(GoogleSignInOptions.DefaultSignIn) .RequestIdToken("вставьте свой токен :)") .RequestEmail() .Build(); googleApiClient = new GoogleApiClient.Builder(this) .AddApi(Auth.GOOGLE_SIGN_IN_API, gso).Build(); googleApiClient.Connect(); firebaseAuth = GetFirebaseAuth(); string loginCheck = Preferences.Get("userName", "default"); //string locationCheck = Preferences.Get("location", "epty"); //if (!Preferences.ContainsKey("location")) // Preferences.Set("location", "msk"); if (Preferences.ContainsKey("location")) { string[] str = Preferences.Get("location", "empty").Split(','); ContentManager.Locations = str.ToList(); } if (loginCheck == "empty" || loginCheck == "default") { SigninButton(); } Dexter.WithActivity(this) .WithPermission(Manifest.Permission.AccessFineLocation) .WithListener(this) .Check(); }
protected override void OnCreate(Bundle savedInstanceState) { base.OnCreate(savedInstanceState); SetContentView(Resource.Layout.CodBarrasV2); //Init View textResult = FindViewById <TextView>(Resource.Id.txt_result); scannerView = FindViewById <ZXingScannerView>(Resource.Id.zxscan); btnFlash = FindViewById <Button>(Resource.Id.btnFlash); btnFlash.Text = "Flash - Desligado"; InitViews(); //Request Permission Dexter.WithActivity(this) .WithPermission(Manifest.Permission.Camera) .WithListener(this) .Check(); }
protected override void OnCreate(Bundle bundle) { TabLayoutResource = Resource.Layout.Tabbar; ToolbarResource = Resource.Layout.Toolbar; base.OnCreate(bundle); global::Xamarin.Forms.Forms.Init(this, bundle); LoadApplication(new App(new AndroidInitializer())); Dexter.WithActivity(this) .WithPermission(Manifest.Permission.WriteExternalStorage) .WithListener(this) .Check(); AppContext = this; CommonTasks.WriteFileToStorage("calibri.ttf"); }
protected override void OnCreate(Bundle savedInstanceState) { base.OnCreate(savedInstanceState); Instanace = this; txt_location = FindViewById <TextView>(Resource.Id.text); TabLayoutResource = Resource.Layout.Tabbar; ToolbarResource = Resource.Layout.Toolbar; Dexter.WithActivity(this).WithPermission(Manifest.Permission.AccessFineLocation) .WithListener(this) .Check(); Xamarin.Essentials.Platform.Init(this, savedInstanceState); global::Xamarin.Forms.Forms.Init(this, savedInstanceState); LoadApplication(new App()); }
protected async override void OnCreate(Bundle savedInstanceState) { base.OnCreate(savedInstanceState); Xamarin.Essentials.Platform.Init(this, savedInstanceState); SetContentView(Resource.Layout.activity_main); Android.Support.V7.Widget.Toolbar toolbar = FindViewById <Android.Support.V7.Widget.Toolbar>(Resource.Id.toolbar); SetSupportActionBar(toolbar); FloatingActionButton fab = FindViewById <FloatingActionButton>(Resource.Id.fab); fab.Click += FabOnClick; btn_create_pdf = FindViewById <Button>(Resource.Id.btn_create_pdf); await Common.Common.WriteFileStorageAsync(this, "FuturaStdMedium.otf"); Dexter.WithActivity(this) .WithPermission(Manifest.Permission.WriteExternalStorage) .WithListener(this) .Check(); }
protected override void OnCreate(Bundle savedInstanceState) { try { if (Connectivity.NetworkAccess == Xamarin.Essentials.NetworkAccess.None) { Android.App.AlertDialog.Builder alert = new Android.App.AlertDialog.Builder(this); alert.SetTitle("Внимание!"); alert.SetMessage("Для продолжения работы проверьте, пожалуйста, интернет-соединение."); alert.SetPositiveButton("Закрыть", (senderAlert, args) => { try { this.Finish(); } catch (Exception ex) { Toast.MakeText(this, ex.Message, ToastLength.Long); } }); Dialog dialog = alert.Create(); dialog.Show(); } base.OnCreate(savedInstanceState); Xamarin.Essentials.Platform.Init(this, savedInstanceState); SetContentView(Resource.Layout.activity_main); Android.Support.V7.Widget.Toolbar toolbar = FindViewById <Android.Support.V7.Widget.Toolbar>(Resource.Id.toolbar); SetSupportActionBar(toolbar); string[] permissions = { Manifest.Permission.AccessFineLocation, Manifest.Permission.WriteExternalStorage, Manifest.Permission.ReceiveBootCompleted, Manifest.Permission.ReadExternalStorage }; Android.Support.V4.App.ActivityCompat.RequestPermissions(this, new string[] { Manifest.Permission.Camera }, MY_PERMISSIONS_REQUEST_CAMERA); Dexter.WithActivity(this).WithPermissions(permissions).WithListener(new CompositeMultiplePermissionsListener(new SamplePermissionListener(this))).Check(); FloatingActionButton fab = FindViewById <FloatingActionButton>(Resource.Id.fab); fab.Visibility = ViewStates.Invisible; string dir_path = System.Environment.GetFolderPath(System.Environment.SpecialFolder.Personal); BottomNavigationView navigation = FindViewById <BottomNavigationView>(Resource.Id.navigation); FragmentTransaction transaction1 = this.FragmentManager.BeginTransaction(); btnAddOrder = navigation.Menu.FindItem(Resource.Id.title_about_us); btnOrders = navigation.Menu.FindItem(Resource.Id.title_reviews); btnExit = navigation.Menu.FindItem(Resource.Id.title_contacts); if (StaticUser.PresenceOnPage == true) { if (CrossSettings.Current.GetValueOrDefault("role", "") == "driver") { Intent intent = new Intent(this, typeof(Activity.MainActivity2)); StartActivity(intent); this.Finish(); } else { try { UserActivity content2 = new UserActivity(); transaction1.Replace(Resource.Id.framelayout, content2); transaction1.Commit(); } catch (System.Exception ex) { Toast.MakeText(this, ex.Message, ToastLength.Long).Show(); } btnAddOrder.SetTitle("Заказать"); btnAddOrder.SetIcon(Resource.Drawable.ic_add_order); btnOrders.SetTitle("Заказы"); btnOrders.SetIcon(Resource.Drawable.ic_orders); btnExit.SetTitle("Выход"); btnExit.SetIcon(Resource.Drawable.ic_menu_exit); } } else { ContentMainActivity content = new ContentMainActivity(); transaction1.Replace(Resource.Id.framelayout, content).AddToBackStack(null).Commit(); btnAddOrder.SetTitle("О нас"); btnAddOrder.SetIcon(Resource.Drawable.ic_dashboard_black_24dp); btnOrders.SetTitle("Отзывы"); btnOrders.SetIcon(Resource.Drawable.ic_notifications_black_24dp); btnExit.SetTitle("Контакты"); btnExit.SetIcon(Resource.Drawable.ic_information); } navigation.NavigationItemSelected += async(sender, e) => { FragmentTransaction transaction = this.FragmentManager.BeginTransaction(); switch (e.Item.ItemId) { case Resource.Id.navigation_home: if (StaticUser.PresenceOnPage == true) { try { UserActivity content = new UserActivity(); transaction.Replace(Resource.Id.framelayout, content); transaction.AddToBackStack(null); transaction.Commit(); } catch (Exception ex) { Toast.MakeText(this, ex.Message, ToastLength.Long); } } else { ContentMainActivity content = new ContentMainActivity(); transaction.Replace(Resource.Id.framelayout, content); transaction.AddToBackStack(null); transaction.Commit(); } break; case Resource.Id.title_about_us: if (StaticUser.PresenceOnPage == true) { AddOrderActivity content = new AddOrderActivity(); transaction.Replace(Resource.Id.framelayout, content); transaction.AddToBackStack(null); transaction.Commit(); } else { Activity_About_As content3 = new Activity_About_As(); transaction.Replace(Resource.Id.framelayout, content3); transaction.AddToBackStack(null); transaction.Commit(); Toast.MakeText(this, "Страница: О нас.", ToastLength.Long).Show(); } break; case Resource.Id.title_reviews: if (StaticUser.PresenceOnPage == true) { ListOrdersActivity content1 = new ListOrdersActivity(); transaction.Replace(Resource.Id.framelayout, content1); transaction.AddToBackStack(null); transaction.Commit(); } else { Activity_Reviews content5 = new Activity_Reviews(); transaction.Replace(Resource.Id.framelayout, content5); transaction.AddToBackStack(null); transaction.Commit(); Toast.MakeText(this, "Страница: Отзывы.", ToastLength.Long).Show(); } break; case Resource.Id.title_contacts: if (StaticUser.PresenceOnPage == true) { Android.App.AlertDialog.Builder alert = new Android.App.AlertDialog.Builder(this); alert.SetTitle("Внимание!"); alert.SetMessage("Вы действительно хотите выйти ?"); alert.SetPositiveButton("Да", (senderAlert, args) => { LeaveProfile(); }); alert.SetNegativeButton("Отмена", (senderAlert, args) => { }); Dialog dialog = alert.Create(); dialog.Show(); } else { Activity_List_Contacts content4 = new Activity_List_Contacts(); transaction.Replace(Resource.Id.framelayout, content4); transaction.AddToBackStack(null); transaction.Commit(); Toast.MakeText(this, "Страница: Контакты.", ToastLength.Long).Show(); } break; } }; DrawerLayout drawer = FindViewById <DrawerLayout>(Resource.Id.drawer_layout); } catch (System.Exception ex) { Toast.MakeText(this, ex.Message, ToastLength.Long).Show(); } //ActionBarDrawerToggle toggle = new ActionBarDrawerToggle(this, drawer, toolbar, Resource.String.navigation_drawer_open, Resource.String.navigation_drawer_close); //drawer.AddDrawerListener(toggle); //toggle.SyncState(); //NavigationView navigationView = FindViewById<NavigationView>(Resource.Id.nav_view);// ! //var account = navigationView.Menu.FindItem(Resource.Id.nav_auth); //var exit1 = navigationView.Menu.FindItem(Resource.Id.nav_exit); //if (CrossSettings.Current.GetValueOrDefault("isAuth","") == "true") //{ // UserActivity content = new UserActivity(); // transaction1.Replace(Resource.Id.framelayout, content).AddToBackStack(null).Commit(); // account.SetTitle(StaticUser.FirstName + " " + StaticUser.LastName); // exit1.SetVisible(true); //} //else //{ // ContentMainActivity home = new ContentMainActivity(); // transaction1.Replace(Resource.Id.framelayout, home).AddToBackStack(null).Commit(); // exit1.SetVisible(false); // account.SetTitle("Войти"); //} //navigationView.SetNavigationItemSelectedListener(this); }
protected override void OnCreate(Bundle savedInstanceState) { try { base.OnCreate(savedInstanceState); // Set our view from the "main" layout resource SetContentView(Resource.Layout.activity_main); string file_data_remember; btn_auth_form = FindViewById <Button>(Resource.Id.btn_auth_form); string[] permissions = { Manifest.Permission.AccessFineLocation, Manifest.Permission.WriteExternalStorage, Manifest.Permission.Camera, Manifest.Permission.ReadPhoneState, Manifest.Permission.Vibrate, Manifest.Permission.AccessNetworkState, Manifest.Permission.Bluetooth, Manifest.Permission.BluetoothAdmin, Manifest.Permission.Internet }; Dexter.WithActivity(this).WithPermissions(permissions).WithListener(new CompositeMultiplePermissionsListener(new SamplePermissionListener(this))).Check(); CrossSettings.Current.AddOrUpdateValue("id", "E353DA5A-07C9-4939-97ED-0CD7CF7B2A7A"); //Android ID //String m_androidId = Android.Provider.Settings.Secure.GetString(ContentResolver, Android.Provider.Settings.Secure.AndroidId); //WLAN MAC Address //Android.Net.Wifi.WifiManager m_wm = (Android.Net.Wifi.WifiManager)GetSystemService(Android.Content.Context.WifiService); //String m_wlanMacAdd = m_wm.ConnectionInfo.MacAddress; //Blue-tooth Address //Android.Bluetooth.BluetoothAdapter m_BluetoothAdapter = Android.Bluetooth.BluetoothAdapter.DefaultAdapter; //String m_bluetoothAdd = m_BluetoothAdapter.Address; //if (CrossSettings.Current.GetValueOrDefault("id", "") == "") //{ // try // { // var box = GetRandomBox(); // if (box.Result.Status == "0") // { // CrossSettings.Current.AddOrUpdateValue("id", box.Result.ResponseData.BoxId); // CrossSettings.Current.AddOrUpdateValue("namebox", box.Result.ResponseData.Name); // } // else // Toast.MakeText(this, "" + box.Result.Message, ToastLength.Long).Show(); // } // catch(Exception ex) // { // Toast.MakeText(this, "" + ex.Message, ToastLength.Long).Show(); // } //} // Переход к форме авторизация btn_auth_form.Click += async(s, e) => { Android.Telephony.TelephonyManager mTelephonyMgr; // Android.Telephony.TelephonyManager mTelephonyMgr = (Android.Telephony.TelephonyManager)GetSystemService(Android.Content.Context.TelephonyService); //Telephone Number mTelephonyMgr = (Android.Telephony.TelephonyManager)GetSystemService(TelephonyService); /*var PhoneNumber = mTelephonyMgr.Line1Number*/; if (mTelephonyMgr.DeviceId != null) { //IMEI number StaticBox.DeviceId = mTelephonyMgr.DeviceId; } else if (Android.Provider.Settings.Secure.GetString(ContentResolver, Android.Provider.Settings.Secure.AndroidId) != null) { //Android ID StaticBox.DeviceId = Android.Provider.Settings.Secure.GetString(ContentResolver, Android.Provider.Settings.Secure.AndroidId); } else { //Hash code //StaticBox.DeviceId = "35" + (Build.Board.Length % 10) + (Build.Brand.Length % 10) + (Build.CpuAbi.Length % 10) + (Build.Device.Length % 10) + (Build.Manufacturer.Length % 10) + (Build.Model.Length % 10) + (Build.Product.Length % 10); //Blue-tooth Address Android.Bluetooth.BluetoothAdapter m_BluetoothAdapter = Android.Bluetooth.BluetoothAdapter.DefaultAdapter; string m_bluetoothAdd = m_BluetoothAdapter.Address; StaticBox.DeviceId = m_bluetoothAdd; } await RegisterBox(); }; } catch (Exception ex) { Toast.MakeText(this, "" + ex.Message, ToastLength.Long).Show(); } }