NfcAdapter.SetDiscoveryTechnology Method
Definition
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
Set the NFC controller to enable specific poll/listen technologies, as specified in parameters, while this Activity is in the foreground.
[Android.Runtime.Register("setDiscoveryTechnology", "(Landroid/app/Activity;II)V", "", ApiSince=35)]
public void SetDiscoveryTechnology (Android.App.Activity activity, Android.Nfc.NfcReaderFlags pollTechnology, Android.Nfc.NfcListenFlags listenTechnology);
[<Android.Runtime.Register("setDiscoveryTechnology", "(Landroid/app/Activity;II)V", "", ApiSince=35)>]
member this.SetDiscoveryTechnology : Android.App.Activity * Android.Nfc.NfcReaderFlags * Android.Nfc.NfcListenFlags -> unit
Parameters
- activity
- Activity
The Activity that requests NFC controller to enable specific technologies.
- pollTechnology
- NfcReaderFlags
Flags indicating poll technologies.
- listenTechnology
- NfcListenFlags
Flags indicating listen technologies.
- Attributes
Remarks
Set the NFC controller to enable specific poll/listen technologies, as specified in parameters, while this Activity is in the foreground.
Use #FLAG_READER_KEEP
to keep current polling technology. Use #FLAG_LISTEN_KEEP
to keep current listenig technology. (if the _KEEP flag is specified the other technology flags shouldn't be set and are quietly ignored otherwise). Use #FLAG_READER_DISABLE
to disable polling. Use #FLAG_LISTEN_DISABLE
to disable listening. Also refer to #resetDiscoveryTechnology(Activity)
to restore these changes. </p> The pollTechnology, listenTechnology parameters can be one or several of below list.
Poll Listen
Passive A 0x01 (NFC_A) 0x01 (NFC_PASSIVE_A)
Passive B 0x02 (NFC_B) 0x02 (NFC_PASSIVE_B)
Passive F 0x04 (NFC_F) 0x04 (NFC_PASSIVE_F)
ISO 15693 0x08 (NFC_V) -
Kovio 0x10 (NFC_BARCODE) -
Example usage in an Activity that requires to disable poll, keep current listen technologies:
protected void onResume() {
mNfcAdapter = NfcAdapter.getDefaultAdapter(getApplicationContext());
mNfcAdapter.setDiscoveryTechnology(this,
NfcAdapter.FLAG_READER_DISABLE, NfcAdapter.FLAG_LISTEN_KEEP);
}
</p>
Portions of this page are modifications based on work created and shared by the Android Open Source Project and used according to terms described in the Creative Commons 2.5 Attribution License.