The Art and Science of NFC Programming by Serge Miranda & Anne-Marie Lesas

The Art and Science of NFC Programming by Serge Miranda & Anne-Marie Lesas

Author:Serge Miranda & Anne-Marie Lesas [Serge Miranda]
Language: eng
Format: epub
Tags: Math & Science, Mobile, Web Development
Publisher: Wiley-ISTE
Published: 2017-01-09T16:00:00+00:00


Box 2.8. Android: initializing the NFC adapter

NfcAdapter nfcAdapter = NfcAdapter.getDefaultAdapter(this);

if (!nfcAdapter.isEnabled())

{

//Ask the user to activate the NFC option

}

NOTE.– It is to be noted that if no NFC controller is installed (in the case of a peripheral device that is not NFC enabled), the NFC adapter instance will be null. You will also need to test that the NFC option was properly activated by the user in the system configuration of the Android device (see Figure 2.22) with the isEnabled() method of the adapter, as shown in the source code of Box 2.8.



Download



Copyright Disclaimer:
This site does not store any files on its server. We only index and link to content provided by other sites. Please contact the content providers to delete copyright contents if any and email us, we'll remove relevant links or contents immediately.