Skip to content

Instantly share code, notes, and snippets.

@andersonleite
Created June 30, 2015 13:50
Show Gist options
  • Save andersonleite/bcb93a3d5c6628440760 to your computer and use it in GitHub Desktop.
Save andersonleite/bcb93a3d5c6628440760 to your computer and use it in GitHub Desktop.
@Override
protected void onResume() {
super.onResume();
Log.d(TAG, "enableForegroundMode");
// foreground mode gives the current active application priority for reading scanned tags
IntentFilter tagDetected = new IntentFilter(NfcAdapter.ACTION_TAG_DISCOVERED); // filter for tags
IntentFilter[] writeTagFilters = new IntentFilter[] {tagDetected};
nfcAdapter.enableForegroundDispatch(this, nfcPendingIntent, writeTagFilters, null);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment