Search in sources :

Example 16 with NfcManager

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);
}
Also used : NfcManager(android.nfc.NfcManager) Toolbar(android.support.v7.widget.Toolbar)

Example 17 with NfcManager

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;
}
Also used : NfcManager(android.nfc.NfcManager)

Example 18 with NfcManager

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);
        }
    }
}
Also used : NfcManager(android.nfc.NfcManager) NfcAdapter(android.nfc.NfcAdapter)

Aggregations

NfcManager (android.nfc.NfcManager)18 NfcAdapter (android.nfc.NfcAdapter)15 Test (org.junit.Test)7 SummaryLoader (com.android.settings.dashboard.SummaryLoader)6 Intent (android.content.Intent)3 SuppressLint (android.annotation.SuppressLint)2 PendingIntent (android.app.PendingIntent)2 IntentFilter (android.content.IntentFilter)2 Tag (android.nfc.Tag)2 Bundle (android.os.Bundle)2 LocationManager (android.location.LocationManager)1 AudioManager (android.media.AudioManager)1 ConnectivityManager (android.net.ConnectivityManager)1 WifiManager (android.net.wifi.WifiManager)1 UiObject2 (android.support.test.uiautomator.UiObject2)1 Toolbar (android.support.v7.widget.Toolbar)1 MediumTest (androidx.test.filters.MediumTest)1 AirplaneModeSettings (cyanogenmod.profiles.AirplaneModeSettings)1 ConnectionSettings (cyanogenmod.profiles.ConnectionSettings)1 RingModeSettings (cyanogenmod.profiles.RingModeSettings)1