public override bool OpenUrl( UIApplication app, NSUrl url, NSDictionary options) { appSave.HandleUrl(( Uri )url, BluetoothLowEnergyAdapter.ObtainDefaultAdapter()); return(true); }
protected override void OnMAMCreate(Bundle bundle) { //TabLayoutResource = Resource.Layout.Tabbar; // ToolbarResource = Resource.Layout.Toolbar; base.OnMAMCreate(bundle); UserDialogs.Init(this); global::Xamarin.Forms.Forms.Init(this, bundle); Xamarin.Essentials.Platform.Init(this, bundle); try { // If you want to enable/disable the Bluetooth adapter from code, you must call this. BluetoothLowEnergyAdapter.Init(this); } catch (Exception e) { Utils.Print(e.StackTrace); } // Obtain the bluetooth adapter so we can pass it into our (shared-code) Xamarin Forms app. There are // additional Obtain() methods on BluetoothLowEnergyAdapter if you have more specific needs (e.g. if you // need to support devices with multiple Bluetooth adapters) var bluetooth = BluetoothLowEnergyAdapter.ObtainDefaultAdapter(ApplicationContext); if (Xamarin.Forms.Device.Idiom == TargetIdiom.Phone) { RequestedOrientation = ScreenOrientation.Portrait; } else { RequestedOrientation = ScreenOrientation.Landscape; } // CrossCurrentActivity.Current.Init ( this, bundle ); var data = Intent.Data; // check if this intent is started via custom scheme link if (data != null) { if (data.Scheme == "aclara-mtu-programmer") { //accessCodeTextbox.Text = data.Host; } } // Set our view from the "main" layout resource //SetContentView(Resource.Layout.SplashScreen); Context context = Android.App.Application.Context; PackageInfo info = context.PackageManager.GetPackageInfo(context.PackageName, 0); string appversion = info.VersionName + " ( " + info.VersionCode + " )"; FormsApp app = new FormsApp(bluetooth, UserDialogs.Instance, appversion); LoadApplication(app); app.HandleUrl(new System.Uri(data.ToString()), bluetooth); }