Created
November 9, 2017 13:50
-
-
Save ssaurel/a95613fb8b9342400ddb6508aaa5aa98 to your computer and use it in GitHub Desktop.
onResume method for the NFC Reader tutorial
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@Override | |
protected void onResume() { | |
super.onResume(); | |
if (nfcAdapter != null) { | |
if (!nfcAdapter.isEnabled()) | |
showWirelessSettings(); | |
nfcAdapter.enableForegroundDispatch(this, pendingIntent, null, null); | |
} | |
} | |
private void showWirelessSettings() { | |
Toast.makeText(this, "You need to enable NFC", Toast.LENGTH_SHORT).show(); | |
Intent intent = new Intent(Settings.ACTION_WIRELESS_SETTINGS); | |
startActivity(intent); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment