mirror of
https://github.com/facebook/react-native.git
synced 2025-11-01 09:14:26 +00:00
Linking.getInitialURL() to work with NFC tags on Android (#25055)
Summary: This PR solves bug https://github.com/facebook/react-native/issues/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: https://github.com/facebook/react-native/pull/25055 Differential Revision: D15516873 Pulled By: cpojer fbshipit-source-id: e8803738d857a69e1063e926fc3858a416a0b25e
This commit is contained in:
committed by
Lorenzo Sciandra
parent
ed40f382e8
commit
46500b3e36
@@ -12,6 +12,7 @@ import android.content.ComponentName;
|
||||
import android.content.Intent;
|
||||
import android.content.pm.PackageManager;
|
||||
import android.net.Uri;
|
||||
import android.nfc.NfcAdapter;
|
||||
import android.provider.Settings;
|
||||
|
||||
import com.facebook.react.bridge.JSApplicationIllegalArgumentException;
|
||||
@@ -59,7 +60,7 @@ public class IntentModule extends ReactContextBaseJavaModule {
|
||||
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))) {
|
||||
initialURL = uri.toString();
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user