Skip to content

Commit 46500b3

Browse files
cimitankelset
authored andcommitted
Linking.getInitialURL() to work with NFC tags on Android (#25055)
Summary: This PR solves bug #24393 for Android. Allows an app to be opened with an NFC tag and getting the url trough Linking.getInitialURL() ## Changelog [Android] [Fixed] - This branch checks also for `ACTION_NDEF_DISCOVERED` intent matches to set the initialURL Pull Request resolved: #25055 Differential Revision: D15516873 Pulled By: cpojer fbshipit-source-id: e8803738d857a69e1063e926fc3858a416a0b25e
1 parent ed40f38 commit 46500b3

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

ReactAndroid/src/main/java/com/facebook/react/modules/intent/IntentModule.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
import android.content.Intent;
1313
import android.content.pm.PackageManager;
1414
import android.net.Uri;
15+
import android.nfc.NfcAdapter;
1516
import android.provider.Settings;
1617

1718
import com.facebook.react.bridge.JSApplicationIllegalArgumentException;
@@ -59,7 +60,7 @@ public void getInitialURL(Promise promise) {
5960
String action = intent.getAction();
6061
Uri uri = intent.getData();
6162

62-
if (Intent.ACTION_VIEW.equals(action) && uri != null) {
63+
if (uri != null && (Intent.ACTION_VIEW.equals(action) || NfcAdapter.ACTION_NDEF_DISCOVERED.equals(action))) {
6364
initialURL = uri.toString();
6465
}
6566
}

0 commit comments

Comments
 (0)