initialize nfc plugin
This commit is contained in:
parent
c9d6f5d9d7
commit
d232fbc68c
@ -11,31 +11,31 @@ namespace BTCPayApp.Maui;
|
||||
ConfigChanges.ScreenLayout | ConfigChanges.SmallestScreenSize | ConfigChanges.Density)]
|
||||
public class MainActivity : MauiAppCompatActivity
|
||||
{
|
||||
//protected override void OnCreate(Android.OS.Bundle? savedInstanceState)
|
||||
//{
|
||||
// base.OnCreate(savedInstanceState);
|
||||
// // Initialize NFC Plugin
|
||||
// CrossNFC.Init(this);
|
||||
//}
|
||||
protected override void OnCreate(Android.OS.Bundle? savedInstanceState)
|
||||
{
|
||||
base.OnCreate(savedInstanceState);
|
||||
// Initialize NFC Plugin
|
||||
CrossNFC.Init(this);
|
||||
}
|
||||
|
||||
//protected override void OnResume()
|
||||
//{
|
||||
// base.OnResume();
|
||||
// CrossNFC.OnResume();
|
||||
protected override void OnResume()
|
||||
{
|
||||
base.OnResume();
|
||||
CrossNFC.OnResume();
|
||||
|
||||
// var nfcAdapter = NfcAdapter.GetDefaultAdapter(this);
|
||||
// if (nfcAdapter != null)
|
||||
// {
|
||||
// var intent = new Intent(this, GetType()).AddFlags(ActivityFlags.SingleTop);
|
||||
// var pendingIntent = PendingIntent.GetActivity(this, 0, intent, PendingIntentFlags.Immutable);
|
||||
// nfcAdapter.EnableForegroundDispatch(this, pendingIntent, null, null);
|
||||
// }
|
||||
//}
|
||||
var nfcAdapter = NfcAdapter.GetDefaultAdapter(this);
|
||||
if (nfcAdapter != null)
|
||||
{
|
||||
var intent = new Intent(this, GetType()).AddFlags(ActivityFlags.SingleTop);
|
||||
var pendingIntent = PendingIntent.GetActivity(this, 0, intent, PendingIntentFlags.Immutable);
|
||||
nfcAdapter.EnableForegroundDispatch(this, pendingIntent, null, null);
|
||||
}
|
||||
}
|
||||
|
||||
//protected override void OnNewIntent(Intent? intent)
|
||||
//{
|
||||
// base.OnNewIntent(intent);
|
||||
// // Handle NFC tag discovery
|
||||
// CrossNFC.OnNewIntent(intent);
|
||||
//}
|
||||
protected override void OnNewIntent(Intent? intent)
|
||||
{
|
||||
base.OnNewIntent(intent);
|
||||
// Handle NFC tag discovery
|
||||
CrossNFC.OnNewIntent(intent);
|
||||
}
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user