Also listen to NFC actions for linking url events (#26553)
Summary: This PR solves bug https://github.com/facebook/react-native/issues/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: https://github.com/facebook/react-native/pull/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
This commit is contained in:
Родитель
46090b0e56
Коммит
8d8c3d4e1e
|
@ -36,6 +36,7 @@ import android.content.Context;
|
|||
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;
|
||||
|
@ -462,7 +463,9 @@ public class ReactInstanceManager {
|
|||
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);
|
||||
|
|
Загрузка…
Ссылка в новой задаче