Java Code Examples for android.provider.Settings#ACTION_NFC_SETTINGS

The following examples show how to use android.provider.Settings#ACTION_NFC_SETTINGS . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: PayActivity.java    From HandstandPay with GNU General Public License v2.0 5 votes vote down vote up
@Override
public boolean onOptionsItemSelected(MenuItem item) {
    int id = item.getItemId();

    if (id == R.id.set_as_default) {
        DefaultPaymentAppUtil.ensureSetAsDefaultPaymentApp(PayActivity.this);
        return true;
    } else if (id == R.id.play_animation) {
        LocalBroadcastManager.getInstance(PayActivity.this).sendBroadcast(new Intent(HandstandApduService.PAYMENT_SENT));
        return true;
    } else if (id == R.id.edit_magstripe) {
        startEditMagstripeActivity();
        return true;
    } else if (id == R.id.nfc_settings) {
        NfcAdapter mNfcAdapter = NfcAdapter.getDefaultAdapter(PayActivity.this);

        //Tell the user whether NFC is enabled
        String message = "NFC is enabled: " + mNfcAdapter.isEnabled();
        Toast.makeText(PayActivity.this, message, Toast.LENGTH_SHORT).show();

        //Show the settings regardless of whether it is enabled or not
        Intent intent = new Intent(Settings.ACTION_NFC_SETTINGS);
        startActivity(intent);
    }

    return super.onOptionsItemSelected(item);
}
 
Example 2
Source File: NFCBaseActivity.java    From DeviceConnect-Android with MIT License 2 votes vote down vote up
/**
 * NFC 設定画面を表示します.
 * <p>
 * Android 端末側の設定画面からしか NFC は有効・無効を設定できない。
 * </p>
 */
private void openNfcSetting() {
    Intent intent = new Intent(Settings.ACTION_NFC_SETTINGS);
    startActivity(intent);
}