Exemplo n.º 1
0
        protected override void OnCreate(Bundle savedInstanceState)
        {
            NfcIo.SetCurrentActivityResolver(() => this);

            TabLayoutResource = Resource.Layout.Tabbar;
            ToolbarResource   = Resource.Layout.Toolbar;

            base.OnCreate(savedInstanceState);

            Xamarin.Essentials.Platform.Init(this, savedInstanceState);
            global::Xamarin.Forms.Forms.Init(this, savedInstanceState);

            if (!NfcIo.Current.IsAvailable())
            {
                Toast.MakeText(ApplicationContext, "NFC Reading not supported", ToastLength.Long).Show();
            }
            else if (!NfcIo.Current.IsEnabled())
            {
                Toast.MakeText(ApplicationContext, "NFC Reader not enabled. Please turn it on in the settings.", ToastLength.Long).Show();
            }

            // Toast.MakeText(ApplicationContext, "vor LoadApp", ToastLength.Long).Show();
            try
            {
                LoadApplication(new App(Path.Combine(Android.OS.Environment.ExternalStorageDirectory.AbsolutePath, Android.OS.Environment.DirectoryDownloads)));
            }
            catch (Exception e)
            {
                Toast.MakeText(ApplicationContext, e.Message, ToastLength.Long).Show();
                Toast.MakeText(ApplicationContext, e.StackTrace, ToastLength.Long).Show();
            }
            MainTabViewModel.Current.NFCStartListening += NfcIo.Current.StartListening;
            MainTabViewModel.Current.NFCStopListening  += NfcIo.Current.StopListening;
        }
Exemplo n.º 2
0
 protected override void OnNewIntent(Intent intent)
 {
     base.OnNewIntent(intent);
     NfcIo.OnNewIntent(intent);
 }