- activity
- the Activity to dispatch to
- intent
- the PendingIntent to start for the dispatch
- filters
- the IntentFilters to override dispatching for, or null to always dispatch
- techLists
- the tech lists used to perform matching for dispatching of the NfcAdapter.ActionTechDiscovered intent
Type Reason Java.Lang.IllegalStateException if the Activity is not currently in the foreground
Enable foreground dispatch to the given Activity.
This will give give priority to the foreground activity when dispatching a discovered Android.Nfc.Tag to an application.
If any IntentFilters are provided to this method they are used to match dispatch Intents for both the NfcAdapter.ActionNdefDiscovered and NfcAdapter.ActionTagDiscovered. Since NfcAdapter.ActionTechDiscovered relies on meta data outside of the IntentFilter matching for that dispatch Intent is handled by passing in the tech lists separately. Each first level entry in the tech list represents an array of technologies that must all be present to match. If any of the first level sets match then the dispatch is routed through the given PendingIntent. In other words, the second level is ANDed together and the first level entries are ORed together.
If you pass null for both the filters and techLists parameters that acts a wild card and will cause the foreground activity to receive all tags via the NfcAdapter.ActionTagDiscovered intent.
This method must be called from the main thread, and only when the activity is in the foreground (resumed). Also, activities must call NfcAdapter.DisableForegroundDispatch(Android.App.Activity) before the completion of their Android.App.Activity.OnPause callback to disable foreground dispatch after it has been enabled.
Requires the NoType:android/Manifest$permission;Href=../../../reference/android/Manifest.permission.html#NFC permission.