Skip to content

Commit

Permalink
update the example
Browse files Browse the repository at this point in the history
  • Loading branch information
dangfan committed Dec 21, 2024
1 parent 84ee80c commit dbe64ab
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 6 deletions.
5 changes: 1 addition & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -70,10 +70,7 @@ class MainActivity : FlutterActivity() {
}

override fun onNewIntent(intent: Intent) {
val tag: Tag? = intent.getParcelableExtra(NfcAdapter.EXTRA_TAG)
if (tag != null) {
FlutterNfcKitPlugin.handleTag(tag)
}
intent.getParcelableExtra(NfcAdapter.EXTRA_TAG)?.apply(FlutterNfcKitPlugin::handleTag)
}
}
```
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ class MainActivity : FlutterActivity() {
val pendingIntent: PendingIntent = PendingIntent.getActivity(
this, 0, Intent(this, javaClass).addFlags(Intent.FLAG_ACTIVITY_SINGLE_TOP), PendingIntent.FLAG_MUTABLE
)
// Read the docs for reading specific technologies
adapter?.enableForegroundDispatch(this, pendingIntent, null, null)
}

Expand All @@ -24,7 +25,6 @@ class MainActivity : FlutterActivity() {
}

override fun onNewIntent(intent: Intent) {
val tag: Tag? = intent.getParcelableExtra(NfcAdapter.EXTRA_TAG)
FlutterNfcKitPlugin.handleTag(tag!!)
intent.getParcelableExtra(NfcAdapter.EXTRA_TAG)?.apply(FlutterNfcKitPlugin::handleTag)
}
}

0 comments on commit dbe64ab

Please sign in to comment.