Electronic Components Datasheet Search
  English  ▼
ALLDATASHEET.NET

X  

AN4430 Datasheet(PDF) 24 Page - STMicroelectronics

Part # AN4430
Description  Designing an NFC Android Application for M24SR and M24LR devices
PDF  42 Pages
Scroll/Zoom Zoom In 100%  Zoom Out
Manufacturer  STMICROELECTRONICS [STMicroelectronics]
Direct Link  http://www.st.com
Logo STMICROELECTRONICS - STMicroelectronics

AN4430 Datasheet(HTML) 24 Page - STMicroelectronics

Back Button AN4430 Datasheet HTML 20Page - STMicroelectronics AN4430 Datasheet HTML 21Page - STMicroelectronics AN4430 Datasheet HTML 22Page - STMicroelectronics AN4430 Datasheet HTML 23Page - STMicroelectronics AN4430 Datasheet HTML 24Page - STMicroelectronics AN4430 Datasheet HTML 25Page - STMicroelectronics AN4430 Datasheet HTML 26Page - STMicroelectronics AN4430 Datasheet HTML 27Page - STMicroelectronics AN4430 Datasheet HTML 28Page - STMicroelectronics Next Button
Zoom Inzoom in Zoom Outzoom out
 24 / 42 page
background image
How to create an Android Application for ST dual memories
AN4430
24/42
DocID025722 Rev 1
2.5.2
NFC Adapter and foreground Dispatch
Involving with NFC sub system requires retrieving the reference of the NFC adapter. In
onCreate() callback developer grabs a reference to the NFC adapter:
Add a new class member to the activity class. This mAdapter reference allows to listening
the tag being scanned:
Retrieve the default NFC adapter on component creation:
In order to declare the application to grab NFC intents and to answer to all NFC intent while
the activity is running (see activity lifecycle stage1) NFC dispatch capabilities has to be
called in onResume() and disabled in onpause() callbacks.
With the previous enableForegroundDispatch(), activity is declared as a grabber of whole
NFC intents while the activity is in foreground state. It’s possible to add filter to only grab
specific NFC intents like ACTION_TAG_DISCOVERED ones. In onResume() call back, it
may then possible to declare a filter and configure the default NfcAdapter with:
2.5.3
Intents and NFC objects treatment
If the MainActivity has been started by the Android System on NFC intent, the activity has to
retrieve the intent and treat it.
This can be done on activity creation (onCreate() callback call) by the following
implementation:
 
NfcAdapter mAdapter; 
mAdapter = NfcAdapter.getDefaultAdapter(this);
@Override 
public void onResume() { 
super.onResume(); 
PendingIntent intent = PendingIntent.getActivity(this, 0, new Intent(this, 
getClass()).addFlags(Intent.FLAG_ACTIVITY_SINGLE_TOP), 0); 
NfcAdapter.getDefaultAdapter(this).enableForegroundDispatch(this,intent, null, 
null); 
}  
@Override  
protected void onPause() {  
super.onPause();  
if (NfcAdapter.getDefaultAdapter(this) != null)  
NfcAdapter.getDefaultAdapter(this).disableForegroundDispatch(this);  
}
PendingIntent pendingIntent = PendingIntent.getActivity(this, 0, 
new Intent(this,     
getClass()).addFlags(Intent.FLAG_ACTIVITY_SINGLE_TOP), 0); 
 
IntentFilter tagtoHandle = new IntentFilter(NfcAdapter.ACTION_TAG_DISCOVERED); 
IntentFilter[] filters = new IntentFilter[] { tagtoHandle }; 
   
mAdapter.enableForegroundDispatch(this, pendingIntent, filters, null);



Html Pages

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42


Datasheet Download

Go To PDF Page


Link URL



Does ALLDATASHEET help your business so far?  [ DONATE ] 

About Alldatasheet   |   Advertisement   |   Contact us   |   Privacy Policy   |   Link to Datasheet    |   Link Exchange   |   Manufacturer List
All Rights Reserved©Alldatasheet.com


Mirror Sites
English : Alldatasheet.com  |   English : Alldatasheet.net  |   Chinese : Alldatasheetcn.com  |   German : Alldatasheetde.com  |   Japanese : Alldatasheet.jp
Russian : Alldatasheetru.com  |   Korean : Alldatasheet.co.kr  |   Spanish : Alldatasheet.es  |   French : Alldatasheet.fr  |   Italian : Alldatasheetit.com
Portuguese : Alldatasheetpt.com  |   Polish : Alldatasheet.pl  |   Vietnamese : Alldatasheet.vn
Indian : Alldatasheet.in  |   Mexican : Alldatasheet.com.mx  |   British : Alldatasheet.co.uk  |   New Zealand : Alldatasheet.co.nz
Family Site : ic2ic.com  |   icmetro.com