Skip to content

Commit

Permalink
Also listen to NFC actions for linking url events (#26553)
Browse files Browse the repository at this point in the history
Summary:
This PR solves bug #26552 for Android. Allows an app to receive url events through Linking from NFC tags

## Changelog
[Android] [Fixed] - This branch checks also for `ACTION_NDEF_DISCOVERED` intent matches to send the url events
Pull Request resolved: #26553

Test Plan: Tested the code multiple times with both NFC tags and normal links

Differential Revision: D17589654

Pulled By: cpojer

fbshipit-source-id: 55e854e765a84da5e22ec2cc51d0fe0972254175
  • Loading branch information
cimitan authored and facebook-github-bot committed Sep 26, 2019
1 parent 46090b0 commit 8d8c3d4
Showing 1 changed file with 4 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@
import android.content.Intent;
import android.content.res.Configuration;
import android.net.Uri;
import android.nfc.NfcAdapter;
import android.os.Bundle;
import android.os.Process;
import android.util.Log;
Expand Down Expand Up @@ -462,7 +463,9 @@ public void onNewIntent(Intent intent) {
String action = intent.getAction();
Uri uri = intent.getData();

if (Intent.ACTION_VIEW.equals(action) && uri != null) {
if (uri != null
&& (Intent.ACTION_VIEW.equals(action)
|| NfcAdapter.ACTION_NDEF_DISCOVERED.equals(action))) {
DeviceEventManagerModule deviceEventManagerModule =
currentContext.getNativeModule(DeviceEventManagerModule.class);
deviceEventManagerModule.emitNewIntentReceived(uri);
Expand Down

0 comments on commit 8d8c3d4

Please sign in to comment.