Karam
Karam

Reputation: 323

How to Ignore NFC Intent(make phone not vibrating)?

I have in my Code an Activity which has 2 Fragments (Logo) and (config). when the activity starts, it launches Logo Fragment. and when I got a new Intent(NFC Tag) it switches to config Fragment. The problem when I am in config Fragment and new NFC tag come close, the activity will response and the device will vibrate.

what I need, just when I in config fragment the phone should not response to any new Tag and not vibrate.

I have tried to set the tag, and test if I already have a tag not to go through the code.

@Override
protected void onNewIntent(Intent intent) {

// with a debugger it vibrate even before testing the the if statement, exactly here.

    if(getTag()!=null){

        return;
    }

    Tag localTag = intent.getParcelableExtra(NfcAdapter.EXTRA_TAG);
    setTag(localTag);
    switchToMainFragment();
    vibrate(300);
}

Upvotes: 2

Views: 432

Answers (0)

Related Questions