protected override void OnCreate(Bundle bundle) { base.OnCreate(bundle); CrossCurrentActivity.Current.Init(this, bundle); UserDialogs.Init(this); NfcManager NfcManager = (NfcManager)Android.App.Application.Context.GetSystemService(Context.NfcService); NFCdevice = NfcManager.DefaultAdapter; Xamarin.Forms.DependencyService.Register <INfcForms, NfcForms>(); PlatformSingleton.Instance.PlatformServiceList.Add <LocationServiceCurrentActivity>(null); PlatformSingleton.Instance.PlatformServiceList.Add <FingerPrintService>(null); PlatformSingleton.Instance.PlatformServiceList.Add <NFCService>(null); //PlatformSingelton.Instance.PlatformServiceList.Add("TelephonyService", // GetSystemService(Context.TelephonyService)); global::Xamarin.Forms.Forms.Init(this, bundle); x = Xamarin.Forms.DependencyService.Get <INfcForms>() as NfcForms; LoadApplication(new App()); }
protected override void OnCreate(Bundle bundle) { instance = this; base.OnCreate(bundle); global::Xamarin.Forms.Forms.Init(this, bundle); NfcManager NfcManager = (NfcManager)Android.App.Application.Context.GetSystemService(Context.NfcService); NFCdevice = NfcManager.DefaultAdapter; Xamarin.Forms.DependencyService.Register <INfcForms, NfcForms>(); x = Xamarin.Forms.DependencyService.Get <INfcForms>() as NfcForms; global::ZXing.Net.Mobile.Forms.Android.Platform.Init(); LoadApplication(new App()); App.ScreenHeight = (double)(Resources.DisplayMetrics.HeightPixels / Resources.DisplayMetrics.Density); App.ScreenWidth = (double)(Resources.DisplayMetrics.WidthPixels / Resources.DisplayMetrics.Density); this.ActionBar.SetIcon(Android.Resource.Color.Transparent); InitPushNotification(); }
public NfcForms() { NfcManager NfcManager = (NfcManager)Android.App.Application.Context.GetSystemService(Context.NfcService); nfcDevice = NfcManager.DefaultAdapter; nfcTag = new NfcFormsTag(); }
public void DisableForeground() { NfcManager nfcManager = (NfcManager)Android.App.Application.Context.GetSystemService(Context.NfcService); var nfcDevice = nfcManager.DefaultAdapter; nfcDevice.DisableForegroundDispatch(this.activity); }
public NfcScannerService() { using (NfcManager NfcManager = (NfcManager)Android.App.Application.Context.GetSystemService(Context.NfcService)) { _nfcDevice = NfcManager.DefaultAdapter; } _nfcTag = new NfcTag(); }
public TagHandlerImplementation() { NfcManager NfcManager = (NfcManager)Android.App.Application.Context.GetSystemService(Context.NfcService); NFCdevice = NfcManager.DefaultAdapter; Xamarin.Forms.DependencyService.Register <INfcForms, NfcForms>(); x = Xamarin.Forms.DependencyService.Get <INfcForms>() as NfcForms; _activity = CrossCurrentActivity.Current.Activity; }
/// <summary> /// Initializes P2P adapter. /// </summary> /// <returns>Returns true if initialize succeeded, false otherwise</returns> public bool P2PInit() { try { p2pAdapter = NfcManager.GetP2pAdapter(); return(true); } catch (Exception e) { Tizen.Log.Debug("NFC_APP", "Failed initialize P2P " + e.Message); return(false); } }
/// <summary> /// Initializes Tag Adapter. /// </summary> /// <returns>Returns true if initialize succeeded, false otherwise</returns> public bool TagInit() { try { tagAdapter = NfcManager.GetTagAdapter(); return(true); } catch (Exception e) { Console.WriteLine("Failed initialize Tag: " + e.Message); return(false); } }
/// <summary> /// Initialize to enable NFC P2p operation. /// </summary> /// <returns>Returns true if initialize succeeded, false otherwise</returns> public bool P2p_init() { try { NfcP2pAdapter = NfcManager.GetP2pAdapter(); return(true); } catch (Exception e) { LogImplementation.DLog("Failed initialize P2P " + e.Message); return(false); } }
/// <summary> /// Initialize to enable NFC Tag operation. /// </summary> /// <returns>Returns true if initialize succeeded, false otherwise</returns> public bool TagInit() { try { NfcTagAdapter = NfcManager.GetTagAdapter(); return(true); } catch (Exception e) { LogImplementation.DLog("Failed initialize Tag " + e.Message); return(false); } }
public void get_status_nfc() { NfcManager NfcManager = (NfcManager)Android.App.Application.Context.GetSystemService(Context.NfcService); NFCdevice = NfcManager.DefaultAdapter; if (NFCdevice != null) { MainViewModel.nfc_status = true; } else { MainViewModel.nfc_status = false; } }
protected override void OnResume() { base.OnResume(); mNfcAdapter = NfcAdapter.GetDefaultAdapter(this); //NFC機能なし機種 if (mNfcAdapter == null) { Toast.MakeText(this, "no Nfc feature", ToastLength.Short).Show(); Finish(); return; } //NFC通信OFFモード if (!mNfcAdapter.IsEnabled) { Toast.MakeText(this, "off Nfc feature", ToastLength.Short).Show(); Finish(); return; } //NFCを見つけたときに反応させる //PendingIntent→タイミング(イベント発生)を指定してIntentを発生させる PendingIntent pendingIntent = PendingIntent.GetActivity(this, 0, new Intent(this, typeof(MainActivity)), 0); //タイミングは、タグ発見時とする。 IntentFilter[] intentFilter = new IntentFilter[] { new IntentFilter(NfcAdapter.ActionTagDiscovered) }; //反応するタグの種類を指定。 String[][] techList = new String[][] { new string[] { typeof(Android.Nfc.Tech.NfcA).FullName, typeof(Android.Nfc.Tech.NfcB).FullName, typeof(Android.Nfc.Tech.IsoDep).FullName, typeof(Android.Nfc.Tech.MifareClassic).FullName, typeof(Android.Nfc.Tech.MifareUltralight).FullName, typeof(Android.Nfc.Tech.NdefFormatable).FullName, typeof(Android.Nfc.Tech.NfcV).FullName, typeof(Android.Nfc.Tech.NfcF).FullName, } }; NfcManager manager = (NfcManager)GetSystemService(NfcService); mNfcAdapter.EnableForegroundDispatch(this, pendingIntent, intentFilter, techList); }
protected override void OnCreate(Bundle bundle) { base.OnCreate(bundle); global::Xamarin.Forms.Forms.Init(this, bundle); NfcManager NfcManager = (NfcManager)Android.App.Application.Context.GetSystemService(Context.NfcService); NFCdevice = NfcManager.DefaultAdapter; Xamarin.Forms.DependencyService.Register <INfcForms, NfcForms>(); x = Xamarin.Forms.DependencyService.Get <INfcForms>() as NfcForms; LoadApplication(new NFCFormsSample.App()); }
protected override async void OnCreate(Bundle savedInstanceState) { TabLayoutResource = Resource.Layout.Tabbar; ToolbarResource = Resource.Layout.Toolbar; base.OnCreate(savedInstanceState); MobileBarcodeScanner.Initialize(this.Application); SmsAndroid.dev = this; await CrossMedia.Current.Initialize(); CrossFingerprint.SetCurrentActivityResolver(() => CrossCurrentActivity.Current.Activity); CrossCurrentActivity.Current.Init(this, savedInstanceState); LocalNotificationsImplementation.NotificationIconId = Resource.Drawable.icon; Xamarin.Essentials.Platform.Init(this, savedInstanceState); global::Xamarin.Forms.Forms.Init(this, savedInstanceState); Xamarin.FormsMaps.Init(this, savedInstanceState); CachedImageRenderer.Init(true); NfcManager NfcManager = (NfcManager)Android.App.Application.Context.GetSystemService(Context.NfcService); NFCdevice = NfcManager.DefaultAdapter; CrossNFC.Init(this); Xamarin.Forms.DependencyService.Register <INfcForms, NfcForms>(); x = Xamarin.Forms.DependencyService.Get <INfcForms>() as NfcForms; #if portifolio CrossBadge.Current.SetBadge(9); LoadApplication(new App(new SoapService(), new OpenCVActivity(), new SmsAndroid())); #else if (!OpenCVLoader.InitDebug()) { System.Console.WriteLine("Init OpenCV failed!!"); } else { System.Console.WriteLine("Init OpenCV succefuly!!"); } // Set our view from the "main" layout resource SetContentView(Resource.Layout.Main); mOpenCvCameraView = FindViewById <CameraBridgeViewBase>(Resource.Id.fd_activity_surface_view); mOpenCvCameraView.Visibility = ViewStates.Visible; mOpenCvCameraView.SetCvCameraViewListener2(this); mLoaderCallback = new Callback(this, this, mOpenCvCameraView); #endif }
protected override void OnCreate(Bundle bundle) { TabLayoutResource = Resource.Layout.Tabbar; ToolbarResource = Resource.Layout.Toolbar; base.OnCreate(bundle); global::Xamarin.Forms.Forms.Init(this, bundle); NfcManager NfcManager = (NfcManager)Android.App.Application.Context.GetSystemService(Context.NfcService); _NfcAdapter = NfcManager.DefaultAdapter; // var container = ((NFCReader.App) Xamarin.Forms.Application.Current).Container; // _nfcScannerService = (NfcScannerService) container.Resolve(typeof(INfcScannerService)); _nfcScannerService = Xamarin.Forms.DependencyService.Get <INfcScannerService>() as NfcScannerService; LoadApplication(new App(new AndroidInitializer())); }
protected override void OnCreate(Bundle savedInstanceState) { TabLayoutResource = Resource.Layout.Tabbar; ToolbarResource = Resource.Layout.Toolbar; CrossCurrentActivity.Current.Init(this, savedInstanceState); CrossFingerprint.SetCurrentActivityResolver(() => CrossCurrentActivity.Current.Activity); base.OnCreate(savedInstanceState); //Inicijalizacija DeviceInfo nuget paketa Plugin.CurrentActivity.CrossCurrentActivity.Current.Init(this, savedInstanceState); if (Intent.Extras != null) { foreach (var key in Intent.Extras.KeySet()) { if (key != null) { var value = Intent.Extras.GetString(key); Log.Debug(TAG, "Key: {0} Value: {1}", key, value); } } } IsPlayServicesAvailable(); CreateNotificationChannel(); //Inicijalizacija POPUP nugget paketa Rg.Plugins.Popup.Popup.Init(this, savedInstanceState); Xamarin.Essentials.Platform.Init(this, savedInstanceState); global::Xamarin.Forms.Forms.Init(this, savedInstanceState); //Inicijalizacija Android Lottie nugget paketa AnimationViewRenderer.Init(); CachedImageRenderer.Init(true); //Implementacija NFC-a za skeniranje publikacije NfcManager NfcManager = (NfcManager)Android.App.Application.Context.GetSystemService(Context.NfcService); NFCdevice = NfcManager.DefaultAdapter; Xamarin.Forms.DependencyService.Register <INfcForms, NfcForms>(); x = Xamarin.Forms.DependencyService.Get <INfcForms>() as NfcForms; LoadApplication(new App()); }
protected override void OnCreate(Bundle bundle) { TabLayoutResource = Resource.Layout.Tabbar; ToolbarResource = Resource.Layout.Toolbar; base.OnCreate(bundle); NfcManager NfcManager = (NfcManager)Android.App.Application.Context.GetSystemService(Context.NfcService); NFCdevice = NfcManager.DefaultAdapter; DependencyService.Register <INfcForms, NfcForms>(); x = Xamarin.Forms.DependencyService.Get <INfcForms>() as NfcForms; global::Xamarin.Forms.Forms.Init(this, bundle); LoadApplication(new App()); }
protected override void OnCreate(Bundle bundle) { base.OnCreate(bundle); Forms.Init(this, bundle); FormsMaps.Init(this, bundle); CurrentPlatform.Init(); App.Init(this); new SfScheduleRenderer(); new SfCalendarRenderer(); UserDialogs.Init(() => this); FormsVideoPlayer.Init(); ZXing.Net.Mobile.Forms.Android.Platform.Init(); NfcManager NfcManager = (NfcManager)Android.App.Application.Context.GetSystemService(Context.NfcService); NFCdevice = NfcManager.DefaultAdapter; LoadApplication(new App()); }
private void SetupForeGroundNFC() { NfcManager nfcManager = (NfcManager)Android.App.Application.Context.GetSystemService(Context.NfcService); var nfcDevice = nfcManager.DefaultAdapter; var intent = new Intent(activity, type).AddFlags(ActivityFlags.SingleTop); nfcDevice.EnableForegroundDispatch( this.activity, PendingIntent.GetActivity(this.activity, 0, intent, 0), new[] { new IntentFilter(NfcAdapter.ActionTechDiscovered) }, new string[][] { new string[] { NFCTechs.NfcF, }, } ); return; }
protected override void OnCreate(Bundle savedInstanceState) { base.OnCreate(savedInstanceState); NfcManager NfcManager = (NfcManager)Android.App.Application.Context.GetSystemService(Context.NfcService); NFCdevice = NfcManager.DefaultAdapter; x = Xamarin.Forms.DependencyService.Get <INfcForms>() as NfcForms; // Create your application here Intent CurrentIntent = this.Intent; Bundle bundle = CurrentIntent.Extras; foreach (string key in bundle.KeySet()) { Object value = bundle.Get(key); Console.WriteLine("Key: " + key + " , value: " + value.ToString() + " , value class: " + value.GetType().Name); } }
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); NfcManager NfcManager = (NfcManager)Android.App.Application.Context.GetSystemService(Context.NfcService); NFCdevice = NfcManager.DefaultAdapter; Xamarin.Forms.DependencyService.Register <INfcForms, NfcForms>(); x = Xamarin.Forms.DependencyService.Get <INfcForms>() as NfcForms; LoadApplication(new App()); Window.SetStatusBarColor(Android.Graphics.Color.ParseColor("#000000")); }
public FelicaReaderImplementation(Activity activity, System.Type type) { this.activity = activity; this.type = type; this.felicaCardSubject = new Subject <IFelicaCardMedia>(); NfcManager nfcManager = (NfcManager)Android.App.Application.Context.GetSystemService(Context.NfcService); if (nfcManager == null) { IsEnabled = false; IsSupported = false; } else { IsSupported = true; IsEnabled = nfcManager.DefaultAdapter.IsEnabled; } }
protected override void OnCreate(Bundle bundle) { TabLayoutResource = Resource.Layout.Tabbar; ToolbarResource = Resource.Layout.Toolbar; base.OnCreate(bundle); global::Xamarin.Forms.Forms.Init(this, bundle); NfcManager NfcManager = (NfcManager)Android.App.Application.Context.GetSystemService(Android.Content.Context.NfcService); NFCdevice = NfcManager.DefaultAdapter; Xamarin.Forms.DependencyService.Register <INfc, NfcForms>(); x = Xamarin.Forms.DependencyService.Get <INfc>() as NfcForms; if (NFCdevice == null) { var alert = new AlertDialog.Builder(this).Create(); alert.SetMessage("NFC is not supported on this device."); alert.SetTitle("NFC Unavailable"); alert.SetButton("exit", CancelButtonOnClick); alert.SetCanceledOnTouchOutside(false); alert.Show(); } else { if (!NFCdevice.IsEnabled) { var alert = new AlertDialog.Builder(this).Create(); alert.SetMessage("NFC is currently off."); alert.SetTitle("Please enable NFC to use this app."); alert.Show(); } } telephonyManager = (TelephonyManager)GetSystemService(TelephonyService); IMEINumber = telephonyManager.Imei; Settings.IMEI = IMEINumber; LoadApplication(new App()); }
public void NfcManager_ConnectAndDisconnectDevice() { var dummyAdapter = new DummyNfcAdapter(); var bm = new NfcManager(new[] { dummyAdapter }, null); var device = new NfcDevice { Id = "some-device-id", Name = "Some-device-Uuid" }; dummyAdapter.RaiseDeviceArriveddEvent(device); var devices = bm.GetDiscoveredDevices(); devices.Count().ShouldBe(1); var d = devices.First(); d.Name = device.Name; d.Id = device.Id; dummyAdapter.RaiseDeviceDepartedEvent(device); devices = bm.GetDiscoveredDevices(); devices.Count().ShouldBe(0); }