use of android.nfc.NfcManager in project openhab-android by openhab.
the class OpenHABWriteTagActivity method onCreate.
@Override
protected void onCreate(Bundle savedInstanceState) {
Util.setActivityTheme(this);
super.onCreate(savedInstanceState);
setContentView(R.layout.openhabwritetag);
Toolbar toolbar = findViewById(R.id.openhab_toolbar);
setSupportActionBar(toolbar);
getSupportActionBar().setDisplayHomeAsUpEnabled(true);
NfcManager manager = (NfcManager) getSystemService(Context.NFC_SERVICE);
mNfcAdapter = manager.getDefaultAdapter();
if (savedInstanceState == null) {
getSupportFragmentManager().beginTransaction().add(R.id.writenfc_container, getFragment()).commit();
}
setResult(RESULT_OK);
mSitemapPage = getIntent().getStringExtra("sitemapPage");
Log.d(TAG, "Got sitemapPage = " + mSitemapPage);
mItem = getIntent().getStringExtra("item");
Log.d(TAG, "Got item = " + mItem);
mCommand = getIntent().getStringExtra("command");
Log.d(TAG, "Got command = " + mCommand);
}
use of android.nfc.NfcManager in project open-ecard by ecsec.
the class NFCFactory method getNFCAdapter.
/**
* Return the adapter for NFC.
*
* @return nfc adapter.
*/
public static NfcAdapter getNFCAdapter() {
if (adapter == null) {
LOG.info("Try to create new NFCAdapter...");
NfcManager nfcManager = (NfcManager) context.getSystemService(Context.NFC_SERVICE);
adapter = nfcManager.getDefaultAdapter();
}
return adapter;
}
use of android.nfc.NfcManager in project platform_packages_apps_Settings by BlissRoms.
the class NfcPreferenceController method updateNonIndexableKeys.
@Override
public void updateNonIndexableKeys(List<String> keys) {
final NfcManager manager = (NfcManager) mContext.getSystemService(Context.NFC_SERVICE);
if (manager != null) {
NfcAdapter adapter = manager.getDefaultAdapter();
if (adapter == null) {
keys.add(KEY_TOGGLE_NFC);
keys.add(KEY_ANDROID_BEAM_SETTINGS);
}
}
}
Aggregations